tags:

views:

48

answers:

1

I have a hidden field called Id on the page.

I also have 2 radio buttons with the following markup:

<input type="radio" value="cats" name="xxx" id="x1" checked="checked">
<label for="1st16th">1st &amp; 16th of the month</label>
<input type="radio" value="bananas" name="xxx" id="x2">
<label for="SpecifyRecurrence">Specify Recurrence</label>

For some reason the second is always checked even though the first says it's checked in the markup. It renders correctly in IE. Also, if I change the id of the hidden field to xId then it will render correctly in FF.

This occurs in xhtml as well as html 5.

Is there anything in the docs that says that you shouldn't use Id as an id on the page or is this just a FF bug?

+3  A: 

You are probably testing this by clicking on the second radio button and then pressing Refresh.

Firefox will remember the state of the radio group and use that instead of the default values.

Click in the address bar and press enter to load the page fresh and use the default values.

David Dorward
That is potentially the case. Although that still seems like the wrong behavior to me.
Keith Rousseau
I'm not familiar with the specification, but if it's not defined then it's not wrong. It is unexpected if this is indeed the case, though.
Thomas Owens
Yeah, specs don't cover the issue of browsers remembering forms over back/forward/refresh (which is even more complex now we have the bfcache too). Firefox is trying to be helpful by allowing you to reload a page for updates without losing any input you might have put into a form on it.
bobince