Hi,

My posts from 15th Sept didn't seem to get approval to appear in the forum, 
so I'm assuming this was an oversight and posting 2 of them again in a 
single post this time.

I think there may be a bug in the web2py.js code 
(https://github.com/web2py/web2py/blob/master/applications/welcome/static/js/web2py.js#L263)

The relevant code is shown below, the condition appears to miss the 
situation where the form has no action attribute at all (url === 
'undefined') and so does not use the component url in this case.

var url = form.attr('action');

if ((url === "") || (url === "#")) {
  /* form has no action. Use component url. */
  url = action;
}

I would suggest the code above is replaced with this:

var url = form.attr('action');

if ((url === "") || (url === "#") || (typeof url === 'undefined') {
  /* form has no action. Use component url. */
  url = action;
}

This seemed to fix the problem I was experiencing with forms in a component.

Also, I have been using this form of A helper (see code snippet below) in 
one of pages to update the content of a component, which works fine, 
however the 'data-w2p_remote' attribute of the component's DIV is not 
getting updated with the relevant URL used to update the content.

{{=A('linked page',_href='http://example.com',cid=request.cid)}

As a result, when a form gets loaded, the submitted form doesn't get sent 
to the original function with the correct request.args. Would it be 
possible to update web2py.js so that the component elements' 
'data-w2p_remote' attribute get's updated. I think this would result in 
more consistent behaviour in ajax based applications. I have my own 
javascript code to do this for the time being, but it would be nicer to use 
web2py's own ajax code as this should take care of the intricate web2py 
ajax features.

Thanks.

-- 
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