damerit Posted November 7, 2008 Share Posted November 7, 2008 I want to validate so that if the checkbox of 'bypass' is not checked or if a text field = "" then a message to choose one or the other. I wrote the one below but it deeps asking for input both. I even used the or || operator. Can someone help me make sense of this? .... thnks function validateForm(thisForm){ if ((thisForm.bypass.checked == true) && (thisForm.whatObject.value == "")){ alert("Enter an answer or check bypass."); return false; } Link to comment https://forums.phpfreaks.com/topic/131807-solved-how-to-validate-a-checkbox-and-text-field-together/ Share on other sites More sharing options...
damerit Posted November 7, 2008 Author Share Posted November 7, 2008 I added a true statement and it worked. function validateForm(thisForm){ if ((thisForm.severity.value == "High") && (thisForm.bypass.checked == true) && (thisForm.whatObject.value == "")){ alert("Enter an answer or check bypass."); return false; } Link to comment https://forums.phpfreaks.com/topic/131807-solved-how-to-validate-a-checkbox-and-text-field-together/#findComment-684717 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.