Paolo,

Thanks for responding. I think you may misunderstand the issue with the 
first problem I describe. The code I have shown is part of the trap_form 
function included in web2py.js, not my own code. If the form doesn't have 
an action attribute set, then url does not get defined. It seems sensible 
to me for web2py.js to use the component URL in such a case, and would make 
the trap_form behaviour a little more robust.

For my second issue the original component is already loaded with ajax=True 
and ajax_trap=True. The problem is when I use a link generated by the A 
helper as suggested here: Trapped-Ajax-links-and-the-A-Helper 
<http://web2py.com/books/default/chapter/29/12/components-and-plugins#Trapped-Ajax-links-and-the-A-Helper>.
 
Now this link is in the main page, and I am trying to use it to update a 
component that has already been loaded, but the new content has an extra 
argument added on the the URL.

For example: The original component is loaded from 
http://example.com/myapp/myfunc.load, the trapped link refreshes this same 
component using /myapp/myfunc.load/test/ where test is the first argument 
(request.arg(0)), this will load a form. For my form submit to work, the 
new component url (as stored in data-w2p_remote) should now be 
/myapp/myfunc.load/test. As data-w2p_remote does not get updated when the 
trapped link is clicked my form gets submitted to /myapp/myfunc.load and so 
is missing the first argument that was available when the form was 
generated. Now I know I can get around this by explicitly setting the 
form's action attribute etc, but I think this is a work around and adds 
extra code, when a more elegant solution is possible.

I propose that when trapping the link in this way, that the data-w2p_remote 
should be updated, as this should represent the source of the current 
content of the component, not the original content. By not updating 
data-w2p_remote attribute, the client side DOM is now inconsistent in my 
opinion.

Regards,

Ide.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to