Forum Moderators: open

Message Too Old, No Replies

submitting two forms with one button

         

dawlish

4:43 pm on Mar 14, 2002 (gmt 0)

10+ Year Member



Is it possible to submit two forms with two different actions on a page with one submit button?

If so can anyone advise on how this is achieved or what alternatives I may need to consider.

Thanks

tedster

5:13 pm on Mar 14, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



As far as I know a browser can only submit one form at a time. Here are two discussions I found that might be helpful to you:

IRT message board [irt.org]
FAQTS knowledge base [faqts.com]

(edited by: tedster at 10:36 pm (utc) on Mar. 14, 2002)

txbakers

10:13 pm on Mar 14, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Here's a thought, maybe you can write two forms, with out a button for the second.

When you submit the first form, it will send post data to the server. put a hidden parameter in there which can be read when the page refreshes. Then, in a javascript, look for that hidden parameter, and if TRUE, do a form2.submit() to submit the second. The screen would look like it refreshed, but it should happen quick enough to avoid looking odd.

Let us know if that works.

DrDoc

8:15 pm on Mar 15, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It is possible to submit two forms at the same time .. if you're using frames.

Say that you have two additional "blank" frames. In the FORM tag, set the TARGET to the different frames ..

When the user clicks the button, let it point to a JavaScript function looking somewhat like this:

document.firstform.submit();
document.secondform.submit();

That should work ..