I would like to make sure the user selects a radio button. (as in a Yes, No set) By default none of the buttons are selected. if (strMedical == '') or if (strMedical == 'No'), etc. doesn’t respond. Is there a way to check if a button in a set has been selected and pop up a message if none of the buttons were selected?
Radio buttons have a "checked" parameter. If the button is selected, it's "checked" parameter is true, otherwise it is false. So use the following syntax:
if (!document.formName.strMedical.checked) // not checked
Thanks, Gil. I was able to get that working for checkboxes, but it doesn't seem to work on radio buttons. It returns as unchecked no matter what. Is there a different paramiter that is used by radio buttons?
Yes, a radio button has the attribute "checked". See http://developer.netscape.com/docs/manuals/js/client/jsref/radio.htm#1193294.
Is the radio button really in an array or something?
Post the relevant parts of the form. Better yet, a link to your page.