So the general idea is to
loop through each input field and check validation rules via true or false, right now I'm more looking for recommended reading than anything else, over all I think it should work something like this:
loop through inputs
compare validation rules
if validation rules fail do something
<script type="text/javascript">
<!--
function Valiation(input)
{
var input = document.getElementsByTagName("input");
function inputValidation()
{
// var findlength = "cake is not a lie";
var validInput = 4;
result = (input > validInput) ? true : false;
if(result === true)
{
console.log("clever boy");
}
else if(result === false)
{
console.log("ben dan laowai");
}
console.log(result);
}
console.log(input.length);
input = Array.prototype.slice.call(input);
input.forEach(inputValidation)
{
console.log("will it work?");
}
}
//-->
</script>
<form method="POST" name="myForm">
<input type="text" name="username" placeholder="Username" onblur="return Valiation()"><span id="error"></span><br>
<input type="text" name="email" placeholder="Email address" onblur="return Valiation()"><span id="error"></span>
<input type="submit" value="enter">
</form>