[web2py] Re: Submit current form prior to logout?

2015-02-03 Thread lillian

I'm already handling my own validation so I can sanitize and do the right 
thing as needed.  I'm mostly concerned about preserving user changes in 
cases where they might reasonably expect them to be persisted.

Along those lines, since there is no login expired event (as I understand 
it) there is no way to perform an auto-logout and subsequent auto-submit 
like we've been discussing? 

On Monday, February 2, 2015 at 1:24:17 PM UTC-8, Niphlod wrote:

 that works only if your controller accepts basically any data (very low 
 barrier on validation). My usecase scenario didn't ever involve the user 
 not knowing it's submitting data, and I'd treat half-filled forms with a 
 dedicated controller to clean/purge/mark_as_unreliable data what's coming 
 in...but that's me with my usual scenario.
 The underlying concept in developing is that every app has its own 
 goals... in principle, if you can live with whatever data the user had the 
 time to fill, there's nothing wrong with your approach.

 On Sunday, February 1, 2015 at 4:27:12 AM UTC+1, lillian wrote:


 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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Submit current form prior to logout?

2015-02-02 Thread Niphlod
that works only if your controller accepts basically any data (very low 
barrier on validation). My usecase scenario didn't ever involve the user 
not knowing it's submitting data, and I'd treat half-filled forms with a 
dedicated controller to clean/purge/mark_as_unreliable data what's coming 
in...but that's me with my usual scenario.
The underlying concept in developing is that every app has its own 
goals... in principle, if you can live with whatever data the user had the 
time to fill, there's nothing wrong with your approach.

On Sunday, February 1, 2015 at 4:27:12 AM UTC+1, lillian wrote:


 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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Submit current form prior to logout?

2015-02-02 Thread lillian

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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Submit current form prior to logout?

2015-01-30 Thread Niphlod
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Submit current form prior to logout?

2015-01-30 Thread lillian

Thanks for the reply.

Let's assume that the action is in fact a click on the logout button/menu 
item (I've looked into the onbeforeunload event already, ugh.); I'm not 
quite sure how to intercept the action.  Do I need to add a handler to the 
menu item, have it call form.submit(), do the right things in my controller 
and then finally call logout by hand?  Or is there a better way to do it?

lillian


On Thursday, January 29, 2015 at 12:39:57 PM UTC-8, Niphlod wrote:

 if the log out is an event, like a click on the logout button, you can 
 intercept it, issue a submit with javascript and then actually logout the 
 user... if you're good with javascript-fu, the user won't notice it. 
 If instead the log out is the user closing the window, YMMV. You can 
 hook up to the beforeonload event, but it's quite nasty because:
 - you'd have to work your way through other stuff (the event is raised 
 also on form submits, user clicking on a link that leads to another page, 
 etc)
 - a big alarm gets raised (you surely noticed some of them on the 
 internet, like the page is asking: are you sure you want to leave this 
 page?)



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


[web2py] Re: Submit current form prior to logout?

2015-01-29 Thread Niphlod
if the log out is an event, like a click on the logout button, you can 
intercept it, issue a submit with javascript and then actually logout the 
user... if you're good with javascript-fu, the user won't notice it. 
If instead the log out is the user closing the window, YMMV. You can hook 
up to the beforeonload event, but it's quite nasty because:
- you'd have to work your way through other stuff (the event is raised also 
on form submits, user clicking on a link that leads to another page, etc)
- a big alarm gets raised (you surely noticed some of them on the internet, 
like the page is asking: are you sure you want to leave this page?)

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