Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re^2: Autosave then exit

by phildeman (Beadle)
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.

Replies are listed 'Best First'.
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

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!

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://740229]
[Discipulus]: good morning marto

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (9)
As of 2018-02-19 10:12 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (260 votes). Check out past polls.