How to validate 3 fields in javascript
<p>I want to validate 3 fileds</p>

<ol>
<li>First name text box</li>
<li>Last name text box</li>
<li>Middle name text box</li>
</ol>

<p>here is my code:</p>

<pre><code>function validateForm()
{
    var x=document.forms["myForm"]["fname"].value;
    var y=document.forms["myForm"]["lname"].value;
    var z=document.forms["myForm"]["mname"].value;
    if(((x!='') &amp;&amp; (y=='' &amp;&amp; z==''))
          || ((y!='') &amp;&amp; (x=='' &amp;&amp; z==''))
          || ((z!='') &amp;&amp; (x=='' &amp;&amp; y=='')))
    {
        alert("First name must be filled out");
        return false;
    }
    alert("fill input filed");
    return false;
}
&lt;/script&gt;
</code></pre>

<p>My code is executing like this: if i wont enter anything in any field - alerting, this part is fine. Then when i enter one of the field its alerting me the if part same way if i will enter two text box my if part should be executed, but its not happening.</p>

<p>Can you change that condition please so that if I will fill 2 fields it should alert me at least one field can be filled?</p>
