[FX.php List] Javascript To Validate Radio Button from ValueList
Kim Hawksworth
Kim.Hawksworth at osumc.edu
Wed Jan 17 10:40:11 MST 2007
I¹m trying to use javascript to validate that a radio button created from a
valuelist has been checked. The code I¹m using looks something like this:
function validate_form() {
var isRadioBtnChkd = false;
for (var i = 0; < document.form1.radioBtn.length; i++) {
if (document.form1.radioBtn[i].checked) {
isRadioBtnChkd = true;
}
}
if (!isRadioBtnChkd) {
alert ("Please make a selection from one of the radio buttons!");
return false;
}
return true;
}
This has worked before when the radio buttons have been manually created on
the form instead of from a valuelist. I know with checkboxes and valueLists
you have to tell javascript that they¹re part of an array. Something like
this: var isCheckBox = document.form1[checkbox[]¹]; Does something
similar have to been done with radio buttons? At this point, I¹m stumped.
Any expertise you can provide in this area will be greatly appreciated.
--Kim
--
Kim David Hawksworth, R.Ph., Web Manager
The OSUMC Dept. of Pharmacy
410 W. 10Th Ave, Room 368 Doan
Ph# (614) 293-3765
Pager# (614) 730-8143
Email: kim.hawksworth at osumc.edu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.iviking.org/pipermail/fx.php_list/attachments/20070117/85541152/attachment.html
More information about the FX.php_List
mailing list