Hi,
Sorry if I am repeating the question again..! I did a search in this forum but could not find the exact answer.
Here is my question. I have 2 radio buttons with default selection. What I am doing is when a user clicks on "Close" in the second radio button, the following should happen.
1. It should check if the first radio button has a "Yes" selected else it should prompt the user that they can close only if Yes is selected.
2. Retain the old selection in the second radio button (it can be either Draft, Pending or Cancel).
I was able to accomplish step 1 but not 2. Below is my code:
<html>
<head>
<title> Radio </title>
<script type="text/javascript">
function check()
{
if ( (document.forms[0].one[1].checked == true) && (document.forms[0].two[2].checked == true) )
{
alert("You can close only when criteria is Yes");
return false;
}
}
</script>
</head>
<body>
<b>Criteria Met : </b>
<input type = radio name = one value = "Yes">Yes</input>
<input type = radio name = one value = "No" checked>No</input>
<br><br>
<b>Status :</b>
<input type = radio name = two value = "Draft" onclick=check() checked>Draft</input>
<input type = radio name = two value = "Pending" onclick=check()>Pending</input>
<input type = radio name = two value = "Close" onclick=check()>Close</input>
<input type = radio name = two value = "Cancel" onclick=check()>Cancel</input>
</body>
<html>
Also, the form I have has lot of these 2 radio button sets so I cannot temporarily store all the values in form onload event..!
Your help is greatly appreciated. Thanks in advance,
Balaji.