I've got a separate js file to capture and validate input that's typed into the input boxes. However, I'm not having any luck with it. I've got another example from class that is working correctly but this one will not work.
validator.js
function validateInput() {
var firstName = document.forms["myForm"]["firstName"].value;
if (firstName != NULL || firstName != "")
return false;
else {
return true;
}
}
And my createPerson.php
<script type="text/javascript" src="Scripts/validator.js"></script>
<form name="myForm" onsubmit="return validateInput()" action="createPerson.php" method="post">
<input type="input" name="firstName" id="firstName">
<input type="submit" value="Submit">
No matter what I do (I THINK) the javascript is failing, because if I just have return false; inside the js file, it will not send to createPerson.php. I'm assuming I'm capturing the value incorrectly, so I'm turning to you for some help.