can't submit form: when LOAD'ed(...., ajax=False, ajax_trap=True)

246 views
Skip to first unread message

Jurgis Pralgauskis

unread,
Apr 14, 2013, 6:56:44 PM4/14/13
to web...@googlegroups.com
Hi, 

you can check the issue here

press the "+" alongside "Category Id", which should show a dialog, which was loaded directly but with ajax_trap

Submit does not react anyhow... - where's the rub?

****
If I load it with ajax=True -- it submit ok  , but then I have other issues :/...

****
another workaround for me might be lazy loading...  the dialog would load only on some event (as now it loads on its own, just is shown on event)


Anthony

unread,
Apr 14, 2013, 7:28:12 PM4/14/13
to web...@googlegroups.com
I think the problem might be that you have one form nested inside the other -- try moving the new category form outside of the create product form DOM.

Anthony

Jurgis Pralgauskis

unread,
Apr 14, 2013, 7:32:41 PM4/14/13
to web...@googlegroups.com
googel Chrome inspector shows, that dialog is after/outside <div class="container">...</div>
while Product form is inside main container.


--
 
---
You received this message because you are subscribed to a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/js8yZubo_cQ/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Jurgis Pralgauskis
tel: 8-616 77613;
Don't worry, be happy and make things better ;)
http://galvosukykla.lt

Anthony

unread,
Apr 14, 2013, 8:27:06 PM4/14/13
to web...@googlegroups.com
The forms are nested in the source code (presumably your LOAD is inserted within the body of the main form). Looks like jQuery UI moves the inner form to a different part of the DOM, but notice that the re-located form DOM no longer includes a <form> element. Because of that, the web2py_trap_form() doesn't have any form to trap and submit.

Anthony

Jurgis Pralgauskis

unread,
Apr 15, 2013, 3:31:09 AM4/15/13
to web...@googlegroups.com

The forms are nested in the source code (presumably your LOAD is inserted within the body of the main form). Looks like jQuery UI moves the inner form to a different part of the DOM, but notice that the re-located form DOM no longer includes a <form> element. Because of that, the web2py_trap_form() doesn't have any form to trap and submit.

yes the LOAD is called in another form (as this is special widget behaviour)

how could I workaound this keeping functionality of widget?
 
googel Chrome inspector shows, that dialog is after/outside <div class="container">...</div>
while Product form is inside main container.
I think the problem might be that you have one form nested inside the other -- try moving the new category form outside of the create product form DOM.

Anthony

unread,
Apr 15, 2013, 10:34:23 AM4/15/13
to web...@googlegroups.com
On Monday, April 15, 2013 3:31:09 AM UTC-4, Jurgis Pralgauskis wrote:


The forms are nested in the source code (presumably your LOAD is inserted within the body of the main form). Looks like jQuery UI moves the inner form to a different part of the DOM, but notice that the re-located form DOM no longer includes a <form> element. Because of that, the web2py_trap_form() doesn't have any form to trap and submit.

yes the LOAD is called in another form (as this is special widget behaviour)

how could I workaound this keeping functionality of widget?

That slices uses an Ajax component (i.e., LOAD(..., ajax=True)) -- why not just do it that way?

Anthony

Jurgis Pralgauskis

unread,
Apr 15, 2013, 12:41:28 PM4/15/13
to web...@googlegroups.com
The forms are nested in the source code (presumably your LOAD is inserted within the body of the main form). Looks like jQuery UI moves the inner form to a different part of the DOM, but notice that the re-located form DOM no longer includes a <form> element. Because of that, the web2py_trap_form() doesn't have any form to trap and submit.

yes the LOAD is called in another form (as this is special widget behaviour)

how could I workaound this keeping functionality of widget?

That slices uses an Ajax component (i.e., LOAD(..., ajax=True)) -- why not just do it that way?

with ajax=True   I mentioned other issues, 
if I have forms with 2 levels of parent (with this widget) , 

after I open 3rd form (2nd dialog), the 1st dialog messes up (somehow gets contents of the main page???)

But would be enough to solve this if possible...

Anthony

unread,
Apr 15, 2013, 3:09:58 PM4/15/13
to web...@googlegroups.com
with ajax=True   I mentioned other issues, 
if I have forms with 2 levels of parent (with this widget) , 

after I open 3rd form (2nd dialog), the 1st dialog messes up (somehow gets contents of the main page???)

Not sure why that is happening. An alternative might be to abandon the idea of putting everything in the form widget. Instead, manually create the other two forms elsewhere on the page (i.e., so they're not nested).

Anthony

Jurgis Pralgauskis

unread,
Apr 15, 2013, 3:19:59 PM4/15/13
to web...@googlegroups.com
the other (or maybe connected) issue with ajax=True 
is that it loads 3rd level subforms twice:
1) for the div of 2nd form while it is not loaded
2) for the loaded form of 2nd level...



and I also think of making nested form pattern using ideas from http://web2py.com/books/default/chapter/29/7#One-form-for-multiple-tables



Anthony

--
 
---
You received this message because you are subscribed to a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/js8yZubo_cQ/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Anthony

unread,
Apr 15, 2013, 6:09:12 PM4/15/13
to web...@googlegroups.com
The problem may be related to the interaction between jQuery UI .dialog() and the web2py component (I don't know enough about jQuery UI dialog to track it down, though).

Jurgis Pralgauskis

unread,
Apr 15, 2013, 7:41:57 PM4/15/13
to web...@googlegroups.com

The problem may be related to the interaction between jQuery UI .dialog() and the web2py component (I don't know enough about jQuery UI dialog to track it down, though).

seems not the case, 
I made more experiments

You can customize the parameters ajax and jqueryUIdialog
lets say: ajax=True, jqueryUIdialog=False still messes stuff.  (I even tried commenting out query-ui.js)

whats more interesting - loading without ajax also gives similar mess

***
but whats most interesting that in  UI dialog 3rd level "Submit" works!! :)

probably, because 2nd component is moved to independent div (and does not have form), 
the 3rd can have the form of its own ;)  might be workaround..?


(my yesterdays experiments were a bit not precise (had bug), and I didn't notice it)

Jurgis Pralgauskis

unread,
Apr 15, 2013, 9:52:18 PM4/15/13
to web...@googlegroups.com
PLEASE ignore previous message (code was still inconsistent,  but UI is not the cause of problem)

the cause was that the "+" button had a class "w2p_trap" 
(copied from grid without suspicion that class name can have effect..)
but it caused the mystic happen :)...


Anthony

unread,
Apr 15, 2013, 9:56:06 PM4/15/13
to web...@googlegroups.com
Yes, just figured that out -- noticed you were making code changes and finally removed that class.

Anthony

Jurgis Pralgauskis

unread,
Apr 15, 2013, 9:58:33 PM4/15/13
to web...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages