Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
How do I keep my users from losing form data when pressing back button
Old 01-31-2007, 06:46 PM How do I keep my users from losing form data when pressing back button
Junior Talker

Posts: 3
Trades: 0
I have been working on a web application that will run as an internal only tool for my radio station. All of the pages are rendered by PHP and the entire thing is very form heavy. The one real problem that I'm having is that if a user navigates away from a page and then presses the back button anything they have entered into the form on that page is gone. How can I make it so that their input stays there? I'd prefer not to do this using PHP and would rather use something client side if possible.

I was able to put together a script that will save form input into cookies, but I cannot figure out how to make it not load the input every time that page is visited by the user in the future. I would much rather prefer that if the user is navigating to a new instance of that page it be loaded blank and only load saved info if they user is pressing the back/forward buttons on the browser to return to the page.

As a user of other sites, this is always something I took for granted and had never realized that it wasn't automatic until I started this project.

Help!
AndyNJ is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 01-31-2007, 08:57 PM Re: How do I keep my users from losing form data when pressing back button
ablaye's Avatar
Ultra Talker

Posts: 437
Location: WebmasterGround.com
Trades: 5
Well, you have to use PHP variables to load back the post data when someone hits the back buttom.
It can not be done with javascript. It has to be done with your php or asp script.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
ablaye is offline
Reply With Quote
View Public Profile Visit ablaye's homepage!
 
Old 01-31-2007, 09:12 PM Re: How do I keep my users from losing form data when pressing back button
Junior Talker

Posts: 3
Trades: 0
Wouldn't I have the same problem using PHP session variables to do this as I am having using javascript and cookies?

Using a session variable would last the entire session just like my cookies are and if I cleared them upon successful form submission (which I can also do with Javascript), then the user won't be able to press back from that point. For many forms, this isn't a problem, but for searches this sucks because if the user doesn't find what they are looking for and press back, they would have to re-enter all their search criteria (there are about 20 fields for searching in one of the forms) instead of just changing one or two things.
AndyNJ is offline
Reply With Quote
View Public Profile
 
Old 01-31-2007, 11:59 PM Re: How do I keep my users from losing form data when pressing back button
Junior Talker

Posts: 3
Trades: 0
Also, that doesn't do the user a lot of good if they don't submit the form and hit the back button or accidentally click on a link to another page.

:-/
AndyNJ is offline
Reply With Quote
View Public Profile
 
Old 02-02-2007, 05:14 AM Re: How do I keep my users from losing form data when pressing back button
saadatshah's Avatar
Extreme Talker

Posts: 215
Name: Syed Saadat Ali
Location: Lahore, Pakistan
Trades: 0
set page caching
__________________
- -- --- ---- ----- ------ ------- ---------------
If you have knowledge, let others light their candles in it.
saadatshah is offline
Reply With Quote
View Public Profile Visit saadatshah's homepage!
 
Reply     « Reply to How do I keep my users from losing form data when pressing back button
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.20883 seconds with 12 queries