troubleshooting Question

Help With Forms

Avatar of techzzz
techzzz asked on
11 Comments1 Solution402 ViewsLast Modified:

Below is a script that I'm working on that submits several forms to a specified location with the click of only one submit button:

<script language=javascript>
function submitall()
    document.form1.action = "http://www-form1-com" = "iframe1";

    document.form2.action = "http://www-form2-com" = "iframe2";

    document.thanks.location.href = "thanks.html";

    return true;


<iframe name="iframe1" width="1" height="1"></iframe>

<iframe name="iframe2" width="1" height="1"></iframe>

<iframe name="thanks" width="500" height="300"></iframe>

<FORM name="form1" method="post">
<INPUT type="text" name="name">
submit form 1?<input type="checkbox" name="operation" value="1">

<FORM name="form2" method="post">
<INPUT type="text" name="name">
submit form 2?<input type="checkbox" name="operation" value="2">

<input type="submit" value="Send" onclick="return submitall();">

As you can see - each form is submitted and then loaded into an invisible traget iframe (iframe1 and iframe2).

A thank you page is then loaded into a visible iframe named "thanks".

My question is this:

1- Is it possible to submit each form without the use of an invisible target iframe or window? Can javascript submit forms without actually opening the form action for each form?

2- Also, how can I allow my visitors to choose which forms the script submits to by using checkboxes? So if only the checkbox for form1 is checked, it only submits to:

document.form1.action = "http://www-form1-com"

All help is appreciated - thank you
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 11 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 11 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros