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
    Regular Coder
    Join Date
    Mar 2006
    Location
    Nigeria
    Posts
    192
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Removing form content on submit

    I have a simple form (containing only a text field). When something is entered into it and submitted, clicking back on the browser displays the form contents again. Dis however doesnt happen to all my forms. Im thinking probably because this contains only one field.
    any way to overcome this?

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    The Netherlands, Baarn, Ut.
    Posts
    4,252
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Back

    Using the "back" button, the page containing the form is probably retrieved from the browser's cache; I don't think you can influence this behaviour, other then changing the browser settings. Also, this behaviour is not reliable enough to expect it to do one thing or another consistently: if the browser decides it's unable to reliably load the page back, you could get an error message, or the original page is loaded again.

    You can't, or shouldn't, try to prevent users from using the back button; what can be done is forwarding the user to a useful page after submitting the form. For example, after submitting this response this forum shows a page that confirms my reply has been processed and then forwards me to the discussion that I replied upon; there's no need for me to hit the back button.
    Regards,
    Ronald.
    ronaldvanderwijden.com

  • #3
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,642
    Thanks
    0
    Thanked 649 Times in 639 Posts
    What browsers do when you press the back button to go back to a page with a form depends on which browser you are using. Some will repopulate all fields except passwords, some wont repopulate anything, and some will ask if you want to reload your prior content. The only way to change from one of these options to another is to change which browser you are using.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.


  •  

    Posting Permissions

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