Conditional logic for 2 forms with one submit
<p>With the help of Nick Craver, I am now able to have two forms with two separate PHP processing scripts use one submit button. I need to expand on this a little bit. I need it to work so that if you have a value in input#retUser it submits with formOne action. If you have a value in #fname &amp;&amp; #lname &amp;&amp; #email1 it submits with formTwo Action. If there is NO value in any field return an alert. </p>

<pre><code>  &lt;form name="returning" method="post" action="PHPscript1.php"&gt;
  &lt;label&gt;Are you a returning user? Please Enter Your Key&lt;/label&gt;
  &lt;input type="text" name="retUser" id="retUser" /&gt;
  &lt;/form&gt;
  &lt;/div&gt;

  &lt;div id="formTwo"&gt;
  &lt;form name="newUser" method="post" action="PHPscript2.php"&gt;
  &lt;label&gt;Are you a new user? Register here&lt;/label&gt;
  &lt;label&gt;First Name&lt;/label&gt;
  &lt;input type="text" name="fname" id="fname" /&gt;
  &lt;label&gt;Last Name&lt;/label&gt;
  &lt;input type="text" name="lname" id="lname" /&gt;
  &lt;label&gt;Email&lt;/label&gt;
  &lt;input type="text" name="email1" id="email1" /&gt;
  &lt;/form&gt;
  &lt;/div&gt;

  &lt;div id="submitContain"&gt;
  &lt;input type="submit" id="sbtBtn" value="submit" /&gt;
  &lt;/div&gt;
</code></pre>

<p>I split the submit function into two separate ones so I can add validation for each later.</p>

<pre><code>$("#formOne").submit(function() {
alert("Trying to submit to: formOne");
return false;
});

$("#formTwo").submit(function() {
alert("Trying to submit to: formTwo");
return false;
});

$("#sbtBtn").click(function() {
if($("#retUser").val()) {      //check if #retUser has a value
$("#formOne").submit();
} else if ($("#fname").val() &amp;&amp; $("#lname").val() &amp;&amp; $("#email1").val()) {
$("#formTwo").submit();
}
});
</code></pre>

<p>what I can't get is the "If there is NO value in any field return an alert"
thx</p>
