1

I have created a small test page to demonstrate a problem I am having with unwanted selections in select boxes.

<html>
<body>
    How clever are you?
    <form action = "http://www.google.com">
        <select name="select">
          <option value="1">Very</option> 
          <option value="2" selected>Extremely</option>
          <option value="3">Extraordinarily</option>
        </select>
        <input type = "submit"/>
    </form>
</body>
</html>

The problem that I am having can be reproduced as follows:

  • Select something that is not the default ("Very" or "Extraordinarily")
  • Submit the form
  • Press the back button on your browser to return to the test page

What I would have expected was that the page would be refreshed and the specifically selected option ("Extremely"), would be once again selected, but it is set to the last value that the user set. I have tried to find a workaround for this problem, but have been unable to do so. Could someone please point me in the direction of why this occurs in the first place?

unor
  • 92,415
  • 26
  • 211
  • 360

1 Answers1

0

Benjamin Todts gave the correct answer:

Take a look at this question: Browser caching select tag state and ignoring selected="true"

Community
  • 1
  • 1