Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^2: Autosave then exit

by phildeman (Acolyte)
on Jan 30, 2009 at 16:37 UTC ( #740229=note: print w/ replies, xml ) Need Help??


in reply to Re: Autosave then exit
in thread Autosave then exit

So, I have an application that I am writing for our Intranet. The client wants the session to last at least 2 hours or more, because users are interrupted all the time. My argument is that this enables users to be careless and walk away from their machines. Nonetheless, if I can save the data that is on the form, and subsequently force the application to log them out, I can keep the session time less than 1 hour.

My intention is to put as little data as possible on the session, meaning nothing to with the form data. With regards to reentry, I will always test the data to see if it exists before attempting to create a new record.

I guess I can use JavaScript, my only concern is if any user has disabled JavaScript on their browser, then they will potentially loose data, if the session time runs out.


Comment on Re^2: Autosave then exit
Re^3: Autosave then exit
by mr_mischief (Monsignor) on Jan 30, 2009 at 16:42 UTC
    You still have a fundamental limitation of the form data that's in the browser and not submitted not being present on the server. If it's a multi-part form that has had data previously submitted, you can save the already submitted data. If the browser is closed without submitting part of the data, there is no way for the server to get that portion of the data at all.
      I think as I sit here and ponder, I will attempt to use Ajax to call a controller method that will write the data to the database, then return the primary key and hide it in the form. This way when the users return to complete the form, instead of writing a new record, it will use the primary key to update the existing record. And if the application has logged the user out, then when the user returns to the form, the application will check to see if a record already exists. If yes, it will retrieve the partially saved data, otherwise, the form will have blank fields.

      This has been a great exercise in thought. Thanks for your help!
Re^3: Autosave then exit
by jethro (Monsignor) on Jan 30, 2009 at 16:45 UTC

    Normally they won't loose any data, because in their browser they still have all the data in the form

    What you can do on the server side is ensure that when they try to submit that data after their session has run out, that that data gets accepted after login. So they get asked for username and password again and if that is correct either the server has remembered the form data and submits it automatically or they get forwarded to the page they had been with the form data they had at that time filled in. Then they just have to klick the submit button again

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://740229]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (9)
As of 2014-08-29 18:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (286 votes), past polls