K
Ken Loomis
Hello:
On a web page I check the value of a cookie and set one of two radio
buttons accordingly.
function setRadioForm() {
var myCookie = document.cookie;
var OpenOnly = myCookie.substring(9);
if (OpenOnly == "True") {
document.ViewOptions.Open.checked = true;
}
else {
document.ViewOptions.All.checked = true;
}
}
<body onload="setRadioForm()">
This works fine. The correct radio button appears checked when the
form opens. However, when the user checks one of the buttons (usually
the unchecked one), both buttons remain checked.
Here's the code on the form:
<form name='ViewOptions">
<input type="radio" name="Open" value="True"
onclick="setCookie("True")> Always, show me open items only.
<input type="radio" name="All" value="False"
onclick=setCookie("False")>Always show me all items, open and closed.
</form>
The onclick fires correctly, but the button which was not clicked
remains checked. Am I doing something wrong or is this a limitation
in the browser/code?
On a web page I check the value of a cookie and set one of two radio
buttons accordingly.
function setRadioForm() {
var myCookie = document.cookie;
var OpenOnly = myCookie.substring(9);
if (OpenOnly == "True") {
document.ViewOptions.Open.checked = true;
}
else {
document.ViewOptions.All.checked = true;
}
}
<body onload="setRadioForm()">
This works fine. The correct radio button appears checked when the
form opens. However, when the user checks one of the buttons (usually
the unchecked one), both buttons remain checked.
Here's the code on the form:
<form name='ViewOptions">
<input type="radio" name="Open" value="True"
onclick="setCookie("True")> Always, show me open items only.
<input type="radio" name="All" value="False"
onclick=setCookie("False")>Always show me all items, open and closed.
</form>
The onclick fires correctly, but the button which was not clicked
remains checked. Am I doing something wrong or is this a limitation
in the browser/code?