tobeyt23 Posted September 21, 2007 Share Posted September 21, 2007 Need help checking that either radio id=1 or id=2 or id=3 is checked. Each radio id may contain more than 1 option. Any ideas on how to does this? Link to comment https://forums.phpfreaks.com/topic/70173-radio-form-check-if-true/ Share on other sites More sharing options...
tobeyt23 Posted September 21, 2007 Author Share Posted September 21, 2007 I did this and it seems to work, does anyone see something wrong with it? function radioEducationHasValue() { var found = false; els = document.getElementsByName('hs_grade'); for(j=0;test = els[j];j++) { if( test.checked ) { found = true; } } els = document.getElementsByName('c_grade'); for(j=0;test = els[j];j++) { if( test.checked ) { found = true; } } els = document.getElementsByName('post_grad'); for(j=0;test = els[j];j++) { if( test.checked ) { found = true; } } if( !found ) { alert('Highest level compeleted must have one selected'); return false; } return true; } Link to comment https://forums.phpfreaks.com/topic/70173-radio-form-check-if-true/#findComment-352465 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.