Processing one form after another

Hi everybody.

I have a page with two forms to send data in an online shop.

The first: “form” processes personal information to an email address (online@the web site. com).
The second, “form-order”, takes some options from “form” and processes in the way described below.

The summarised coding after removing some elements and options would be like this:


 <form name="form" action="http://cgi.the web site.com/FormMail.pl" method="post">
        <input type="hidden" value="968" name="order"/>
        <input type="hidden" name="redirect"/>
        <input type="hidden" value="online@the web site. com" name="recipient"/>
        <input type="hidden" value="Purchase Attempt" name="subject"/>
        <input name="required" type="hidden" value="Name,Address, E-Mail"/>
          <h2>Personal Identification</h2>
            <div id="fa"><p>Full Name<input name="Name" type="text" id="Name"/></p></div>
        </div>
       <div id="fa">
          <h2>Contact Details</h2>
            <div id="fab"><p>Address<input name="Address" type="text" id="Address"/></p></div>
            <div id="fac"><p>E-Mail<input name="E-Mail" type="text" id="E-Mail"/></p></div>
       </div>

          <div id="fza"><input onclick="Javascript:aceptar()" type="button" value="SUBMIT" name="Submit"/></div>
          <div id="fzb"><input type="reset" class="Button" value="ERASE"/></div>
        </div>
      </form>
      <form name="form-order" action="control.php" method=post target=_blank">
        <input type="hidden" name="operation"/>
        <input type="hidden" name="Total"/>
      </form>

The idea is to process the first form with personal identification data, and then, if the required filds are completed, processed the second form (form-order) with the operation data to be sent to control.php, which process such information.

The form-order is processed by:

document.form-order.submit();

I worked with an .asp-based system and I have received this model.

The problem is that form-order is processed anyway, whether you have filled the required fields or not, since “form” is just not processed.

If we set this way:

document.form.submit();
document.form-order.submit();

Two independent forms are processed, but the same result: form-order is always processed.

The idea is to add some condition or function for form-order to be processed just after the first form has been properly filled and sent.

Or perhaps some redirection.

???