Thanks Leonel - awesome explanation.  I looked through your code that you 
posted to load forms in modals and handle file uploads - I need to study 
more.

One question - you say below "you're using web2py's ajax convenience 
function which doesn't care about what it's doing" - I'm actually not using 
the web2py ajax function but rather the jQuery post function.  Did you mean 
to say "jQuery's post function which doesn't care" vs. the web2py ajax 
function which would then hand the disabling/enabling of form elements?



On Thursday, August 14, 2014 9:56:20 PM UTC-4, Leonel Câmara wrote:
>
> In a jquery event handler returning false is the same as calling 
> event.preventDefault and event.stopPropagation that's why you don't get the 
> Working... anymore, you are stopping web2py.js handlers for submission from 
> being processed. Namely this one:
>
>       $(doc).on('submit', 'form', function () {
>         var submit_button = $(this).find(web2py.formInputClickSelector);
>         web2py.disableElement(submit_button);
>       });
>
> Which is what disables the button and puts the Working... there. 
>
> The reason you're having problems is that you're using web2py's ajax 
> convenience function which doesn't care about what it's doing, it just 
> cares about submitting form inputs. So it never sets the form handlers 
> which re-enable the buttons.
>
> One thing you can do is disable the element yourself in your submit 
> handler using $.web2py.disableElement
>
> And then have something like:
>
> $(document).on('ajax:complete', '#myForm', function (e) {
>         $.web2py.enableFormElements($(this));
>       });
>
>

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