liquinas Posted January 12, 2012 Share Posted January 12, 2012 Having a bit of a brain fart here. This function is triggered on form submit, which works just fine and fires off heylisten(); if none of the IFs return false. The problem is that once I get to the multiple condition IF statements (the one that checks for specialty8), if the condition doesn't apply because specialty8 is not checked, it returns true and submits the form instead of continuing on to the next IF statement below it. Any help appreciated. function validate(frm) { if (frm.type[frm.type.selectedIndex].value == "") { joff(); alert("You must specify the type of person."); return false; } if (frm.fname.value == "") { joff(); alert("You must provide a first name."); return false; } if (frm.lname.value == "") { joff(); alert("You must provide a last name."); return false; } if ((frm.specialty8.checked == true) && (frm.otherspecialty.value == "")) { joff(); alert("If you select \"Other\" you must enter a description."); return false; } if ((frm.modality11.checked == true) && (frm.othermodality.value == "")) { joff(); alert("If you select \"Other\" you must enter a description."); return false; } if ((frm.service8.checked == true) && (frm.otherservice.value == "")) { joff(); alert("If you select \"Other\" you must enter a description."); return false; } if ((frm.payment0.checked == false) && (frm.payment1.checked == false) && (frm.payment2.checked == false)) { joff(); alert("You must select a payment type."); return false; } heylisten(); } //--> </script> Quote Link to comment https://forums.phpfreaks.com/topic/254842-onsubmit-event-if-statements-not-flowing-returns-true-early/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.