Yeah that's basically what I came up with between posting and seeing your 
reply, except I'm letting the code in my controller do the actual db update 
(its that same code used if the user had clicked on submit) and then I 
redirect based on what UI element called submit (submit button? do the 
normal thing.  Logout button? logout. etc.)

Does that make sense?  It works but I'm wondering if there might be issues 
I'm not aware of.  Kinda new to this type of programming :-/

On Friday, January 30, 2015 at 1:31:08 PM UTC-8, Niphlod wrote:
>
> the gist of it should be something like
>
> $(function() {
>     $('a#thelogoutbutton').on('click', function(e) {
>         e.preventDefault();
>         if (code_to_submit_the_form() == 'everythingwentwell') {
>             window.href = this.href;
>         } else {
>             managefailure();
>             //optionally window.href = this.href
>         } 
>     })
> })
>
> as a general rule, it's not a "polite thing" to do to block on something 
> if the user presses "i want to go out of here", so be sure to do it as 
> switfly as possible (i.e. don't require a strict check on 
> code_to_submit_the_form() and make it happen in under a half second).
>

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to