Below is a simplified snippet of code from a form validation script. It does not work...
When the form is submitted and the user has left "inputfield" empty, the first alert pops up. After the user has entered something in "inputfield", the second alert pops up when the user clicks submit.
Afterwards, the script should return false and continue validation. I need both alerts to be included in the same else if. What am I doing wrong? The alerts do not show and the form validation ignores this portion of code...
} else if (myform.inputfield.value=="") {
alert ('Please enter something in the text field!');
}
if (myform.inputfield.value!=="") {
alert ('Thank you for entering something in the field!');
return false;
}
document.getElementByIdto find the field.