kondakindi
IS-IT--Management
Hi,
I have a couple of radio buttons in my form and when the form is submitted i need to check which radio button is checked. I am not able to get the value of the radio button. even after checking the radio button it is showing a msg not checked.
here is my code.
function validate(f)
{
var empty = false;
if (f.Datetype.checked == true)
alert(f.Datetype.value);
else
alert(" not checked");
}
</script>
<body>
<form name="form1" method="post" action="">
<p><input type="radio" name="Datetype" value="singledate" >Single Date
<input type="radio" name="Datetype" value="betweendate">Between Dates
<br>
<p><input type="submit" value="Submit" name="B1" onclick="return validate(this.form)" ><input type="reset" value="Reset" name="B2"></p>
</form>
</BODY>
</HTML>
Thanks in advance
I have a couple of radio buttons in my form and when the form is submitted i need to check which radio button is checked. I am not able to get the value of the radio button. even after checking the radio button it is showing a msg not checked.
here is my code.
function validate(f)
{
var empty = false;
if (f.Datetype.checked == true)
alert(f.Datetype.value);
else
alert(" not checked");
}
</script>
<body>
<form name="form1" method="post" action="">
<p><input type="radio" name="Datetype" value="singledate" >Single Date
<input type="radio" name="Datetype" value="betweendate">Between Dates
<br>
<p><input type="submit" value="Submit" name="B1" onclick="return validate(this.form)" ><input type="reset" value="Reset" name="B2"></p>
</form>
</BODY>
</HTML>
Thanks in advance