Entry
how can i submit 2 forms on one link or one click
Apr 25th, 2003 22:51
Nel MS, Alain vdh, Amit Arora, parul vedpathak, Nel MS
(To the person who wrote below me) Have you guys ;-) heard of:
You'd have to have the person make 3 frames. Please note that you must
have a working knowledge of controlling framed pages with JavaScript.
(an example of INDEX.HTM page containing 3 frames, page1, 2 and 3)
|--------------------|
|Framed Page 1 |
|(containing Form1) |
|--------------------|
|Framed Page 2 |
|(containing Form2) |
|--------------------|
|Frame Page 3 |
| put your submit |
| button here |
|--------------------|
Your "submit button" placed in framed page 3 is going to be (i used a
normal button; javascript will do the form submission) :
<input type="button"
onClick="parent.frame1name.form1.submit();parent.frame2name.form2.submit
()">
P.S.: To write more than one JavaScript code into an event handler like
onClick, i've seperated it using semicolons [;]. See above.
(If this post is wrong, feel free to modify my post!)
=============================
The code ...
<form name="form1" onSubmit="document.form2.submit();return true;" ... >
...
...
...
</form>
<form name="form2" ... >
...
...
...
</form>
If you want to check or validate before you submit, remove the "return
true"
Warning: it does not work in IE5 (i dont know for other browsers)
the only way i know to do this is to add all input from one form to the
other just before submit like explained in
How do I dynamically add elements to a FORM?
http://www.faqts.com/knowledge_base/view.phtml/aid/1785/fid/129