Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jan 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How do I keep my users from losing form data when pressing back button

    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!

  • #2
    New Coder
    Join Date
    Sep 2004
    Posts
    60
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Clear the cookies related to the form upon successful submission of the form.

    Have the cookies expire after a minute or so.

  • #3
    New to the CF scene
    Join Date
    Jan 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks. I had thought about that, but the only thing that I don't like about that is that for forms that are for searches, I'd like for the user to be able to always press back to revise their search. So even if a minute or two passes or the search is successful, I'd like those values to still appear when they press the back button, yet clicking the link to go to this search page again would still give a blank form.

    I could deal with it not working like this if need be, but before I go updating 130+ files, I'd like to at least be thorough in my research on this.

    p.s. i hate my life right now. :-)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •