justravis Posted August 20, 2007 Share Posted August 20, 2007 i'm just trying to check 1 select menu at this point...it doesnt even trigger <script src='intro.js'></script> <form method=post action=/programs/dmd/mentee/intro.pwr onSubmit='return validForm()'> <input name=required id=required type=hidden value='chan,subchan'> <label>How did you hear about Disability Mentoring Day?<br /> <select name='chan' onChange='showSubchan(this.value)'> <option value=''> Please choose. </option> <option value=2> San Diego Community College District </option> <option value=3> San Diego Unified School District </option> </select> <br /> <div id='selectSubchan'></div></label> <input name=next id=next type=submit value=Next> </form> javascript function validForm(form) { elem=document.getElementByID('chan'); if(elem.value == "Please Choose") { alert(helperMsg); elem.focus(); return false; } else { return true; } } Any thoughts? THANK YOU! Link to comment https://forums.phpfreaks.com/topic/65776-solved-grrsimple-form-validation/ Share on other sites More sharing options...
justravis Posted August 20, 2007 Author Share Posted August 20, 2007 made a few corrections: <script src='intro.js'></script> <form method=post action=/programs/dmd/mentee/intro.pwr onSubmit='return validForm()'> <input name=required id=required type=hidden value='chan,subchan'> <label>How did you hear about Disability Mentoring Day?<br /> <select name='chan' onChange='showSubchan(this.value)'> <option value=''> Please choose. </option> <option value=2> San Diego Community College District </option> <option value=3> San Diego Unified School District </option> </select> <br /> <div id='selectSubchan'></div></label> <input name=next id=next type=submit value=Next> </form> function validForm() { var elem=document.getElementById('chan'); if(!elem.value) { alert('chan'); elem.focus(); return false; } else { return true; } } Link to comment https://forums.phpfreaks.com/topic/65776-solved-grrsimple-form-validation/#findComment-328613 Share on other sites More sharing options...
nogray Posted August 20, 2007 Share Posted August 20, 2007 I think you're missing the id from the select <select name='chan' add id='chan' Link to comment https://forums.phpfreaks.com/topic/65776-solved-grrsimple-form-validation/#findComment-329226 Share on other sites More sharing options...
justravis Posted August 20, 2007 Author Share Posted August 20, 2007 yes, u r right!! I did forget the id attribute! - 1000 cool points for travis i think that oversight cost me almost a day!!!! Link to comment https://forums.phpfreaks.com/topic/65776-solved-grrsimple-form-validation/#findComment-329330 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.