l0b0
l0b0

Reputation: 58918

Avoid form fields resetting when going back after following a link

I'd like to make sure that after editing and then navigating away from a form (pressing Back or clicking a link) and returning (using the Back or Forward button), the form data is not reset. I have verified that this works on another web site. What do I need to check?

Before answering, please note that I'm not submitting and then going back. Simply following links and then returning.

Context:

Upvotes: 1

Views: 481

Answers (1)

Timur Sadykov
Timur Sadykov

Reputation: 11406

Most browsers cache form input values. So when user refreshes page, the inputs have same values.

You should check your code-behind for browser cache manipulations like:

<?
  Header('Cache-Control: no-cache');
  Header('Pragma: no-cache');
  ?>

and also your plain HTML-templates for:

<meta http-equiv="Expires" content="Tue, 01 Jan 2000 12:12:12 GMT">

or

<meta http-equiv="Pragma" content="no-cache">

Upvotes: 2

Related Questions