Check to see if a user has came from a 'forward' page

I am currently working on a form which posts to a web service. The form validation is done at the web service and if a validation error occurs the user is presented with an error and a back button.

The form contains a number of default values which I am auto populating. These values then overwrite any values that the user has inserted when the back button is pressed.

  • Startup JavaScript code is not executed when using the Firefox “Back” button
  • Javascript / jQuery back button - so long as last page was part of current site?
  • Back button bug in Chrome/Safari
  • Button with IonicHistory.goBack()
  • Javascript: Escape key = browser back button
  • Executing a function on initial page load (and user refreshes) but not back button
  • Is there a way I can detect to see if the user has pressed the back button and prevent the auto population?

  • Javascript : go back with new parameters
  • Back button bug in Chrome/Safari
  • back button in browser not working properly after using pushState (in Chrome)
  • How to distinguish browser back / forward button?
  • How do I keep form data when Back button is clicked
  • Control or Disable Browser Back Button with Javascript or AngularJS
  • 2 Solutions collect form web for “Check to see if a user has came from a 'forward' page”

    My guess would be you are filling these post load via JS? Because the value attribute should not override new values. If you are, I would just do a check to see if the field is empty before loading in the text.

    Also, I would look into the placeholder attribute.

    Pass a parameter as part of the URL that your back button sends the user to, then check to see if that parameter is part of the URL of the current page in your Javascript. If it’s present simply don’t populate with the default values.