i got the following code to test whether a radio button has value selected or not.
also lets say there is a radio group 'gender' in html form and there is an onclick="has_value();" event on the submit button, then the question is how can we call this function to pass the radio button meaning what would be the arguments sent?
Thanks in advance.
also lets say there is a radio group 'gender' in html form and there is an onclick="has_value();" event on the submit button, then the question is how can we call this function to pass the radio button meaning what would be the arguments sent?
Code:
function has_value(obj, obj_type)
{
if (obj_type == 'radio')
{
if (obj[0])
{
for (i=0; i < obj.length; i++)
{
if (obj[i].checked)
return true;
}
}
else
{
return (obj.checked);
}
return false;
}
}
Thanks in advance.