I think I've worked out what I *want* to do, but I'm not sure if this is 
easy in web2py. I want to use the onsubmit handler in a form to reload the 
form from a .load view, but return false so that the *final* submit action 
is not called. Then, if the reloaded form validates, I can set response.js 
in the loaded view to actually call .submit() on the form. As I understand, 
this will *not* trigger the onsubmit event 
<https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/submit>, 
but it will go to the url specified in the action. That way I can do, e.g.

<form action="some_other_url" target="_blank" onsubmit="reload_form(); 
return false;">
...
<input type="submit" />
</form>


and only if the form validates will clicking [submit] open up a new tab 
containing some_other_url. Otherwise, the form will be reloaded in-situ 
using AJAX. Is this a reasonable way to proceed, and is there any web2py 
magic that I could use to help with this? Or will I need to code by hand 
all the AJAX reloading in the `reload_form()` function shown above, risking 
duplicating the web2py LOAD() functionality?

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/2a3f5890-76ad-40d8-90d5-7deba21cc387%40googlegroups.com.

Reply via email to