Form Submit Button

Discussion in 'HTML & Website Design' started by mika17, Nov 24, 2007.

  1. #1
    Hi there

    I've searched everywhere for an answer to this little problem.

    I've designed a form that has two layers within it.

    The layers are triggered by a simple password entered into a second form on another part of the page. If you enter the correct password then it triggers the layer with a cheaper price.

    On each layer is a submit button. The action that I want is that upon hitting submit button 1 the form is submitted and emailed and the user is directed to Page X. When submit button 2 is hit the form is submitted and emailed in the same way and the user is directed to page Y.

    The code of my last attempt looks like this:

    <form action="" name="form" ><table width="472" border="0">
    <tr>
    <td width="71">&nbsp;</td>
    <td colspan="2">&nbsp;</td>
    <td width="283">&nbsp;</td>
    </tr>
    <tr>
    <td height="30"><label>First name </label></td>
    <td colspan="2"><input type="text" name="FirstName"></td>
    <td>&nbsp;</td>
    </tr>
    <tr>
    <td height="30"><label>Last name </label></td>
    <td colspan="2"><input type="text" name="LastName"></td>
    <td>&nbsp;</td>
    </tr>
    <tr>
    <td height="30" colspan="2">Name of Practice </td>
    <td colspan="2"><input type="text" name="Practice"></td>
    </tr>
    <tr>
    <td height="30" colspan="2">Return email address </td>
    <td colspan="2"><input type="text" name="Email"></td>
    </tr>
    <tr>
    <td height="30" colspan="2">Website (if applicable) </td>
    <td colspan="2"><input type="text" name="Website"></td>
    </tr>
    </table>
    <div id="Layer1">LAYER 1 - $99.95
    <input type="submit" value="Submit" onclick="document.location = 'freetrial2.html';"></div>

    <div id="Layer2">LAYER 2 - $90.00
    <input type="submit" value="Submit"></div>
    </form>

    The "onclick="document.location" function doesn't seem to work.

    Any help gratefully received

    cheers - mika
     
    mika17, Nov 24, 2007 IP
  2. mika17

    mika17 Peon

    Messages:
    16
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I've figured it out so that each submit button goes to a different page BUT my form validation javascript no longer works, AND it doesn't submit it to my email.

    Now looks like this for the two layers:

    <div id="Layer1">LAYER 1 - $99.95
    <input type="button" name="RegularPay" value="Submit" onClick="document.form.action='http://www.msn.com'; document.form.submit();" /></div>

    <div id="Layer2">LAYER 2 - $90.00
    <input type="button" name="PromoPay" value="Submit" onClick="document.form.action='http://www.ebay.com'; document.form.submit();" /></div>
    </form>
     
    mika17, Nov 24, 2007 IP