Using Form Validation - Multiple Error Display
<p>I'm sorta new to Javascript and am trying to implement fomr validation for a login form, which consists of first name, surname and age. </p>

<p>The actual validation is working fine, but it keeps printing both errors when none of the validation is satisfied. I want to know if it's possible to only print one error at a time, not both.</p>

<pre><code>function Validation() {
// Basic form validation for the login form (ensures first name is entered ensures age      is of required number [5-100])

// Declare the textfields as three seperate variables x, y, z
var x = document.forms["loginform"]["age"].value;
var y = document.forms["loginform"]["firstname"].value;
var z = document.forms["loginform"]["surname"].value;
// Call an error if an input has no entered value (empty)
if (x == null || x == "" || y == null || y == "" || z == null || z == "")
{
    alert("Please enter all required information!");
}
// Call an error if x (age) contains a non-numeral character or if the number is less than 5/more than 100
if (x &lt; 5 || x &gt; 100 || !x.match(/^\d+$/))
{
    alert("Age must be between 5-100 and only contain numerical value(s).");
}
}
</code></pre>

<p>Any help is appreciated, thanks in advance.</p>
