Radio Boxes Not Resetting To "checked" Status In Firefox
Solution 1:
It may be because Firefox is remembering the previous form submission values, which can override any default choices you've defined in your HTML. Also, even though you haven't stated it here, I'd like to point out that Javascript can also override default HTML behavior as well, so if you do have a script running, make sure it also isn't setting/overriding a default value.
Solution 2:
Yes, this basic is broken in Firefox: https://stackoverflow.com/a/8779735/370290
Solution 3:
I originally made the mistake of setting checked=false on the "no" box instead of setting checked="true" on the "yes" box.
However, you might consider a similar fix I came up with to ensure that you get the value you want when the page loads:
<inputtype="radio"name="mybox"id="mybox_yes"value="1"><inputtype="radio"name="mybox"id="mybox_no"checked="checked"value="0"><script>var mybox = 0; // value 1 or 0 inserted with server side scriptif(mybox == 1){
var fix_checkbox = function(){
document.getElementById("mybox_yes").checked=true;
};
}
else
{
var fix_checkbox = function(){
document.getElementById("mybox_no").checked=true;
};
}
setTimeout(fix_checkbox,1000);
</script>
It might be better to do the logic server side then only output the line you want:
<script>setTimeout(function(){document.getElementById("mybox_no").checked=true;},1000);
</script>
Post a Comment for "Radio Boxes Not Resetting To "checked" Status In Firefox"