开发者

Firefox 5 not using select="selected" value on page refresh, retaining old value

I've found a strange bug in Firefox 5 (I don't have access to 4 right now). But, I think it was probably working in Firefox 4 because I just got a new computer and I don't remember seeing this error before.

I have a couple of select boxes. The selected value is based on a session value that can change by some selects in a modal window. When I close the mo开发者_JAVA技巧dal window and refresh the page, instead of updating the select boxes to the correctly selected value, it stays on the value originally chosen when the page first loaded. What's very strange is that when I look at the code in Firebug it shows the correctly selected value, but that is NOT the value the select box shows as selected! I've also run javascript and the selectedIndex is what I see in Firebug and correct, but it is NOT what I see selected.

If I do a hard refresh, I will see the correct value selected. I've tried to set the selectedIndex to the selectedIndex or some other value, but this will ONLY work on a hard refresh--even though I know the code is running because the alerts run. This code works fine in other browsers. Does anyone know of any workarounds?

 <select id="sportid" name="sportid">
      <option value="all">All</option>
      <option selected="selected" value="8">3 on 3 Ice Hockey</option>
      <option value="1">Basketball</option>
      <option value="4">Billiards</option>
      <option value="6">Broomball</option>
      <option value="7">Dodgeball</option>
      <option value="10">Field Hockey</option>
 </select>

So, Even though 3 on 3 Ice Hockey should be selected, and the html says is selected, I see Basketball--which was the previous selection.

Thanks! Ember


Try to add autocomplete="off"

<select id="sportid" name="sportid" autocomplete="off">
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜