View Full Version : Multiple form submit using single button

12-20-2007, 03:48 PM

I need to submit multiple forms with using single button. I've mentioned my code below.

<script type="text/javascript">
function form2Submit() {
alert('Form2 Submitted');

function form1Submit() {
document.getElementById("t1").value = '';
alert('Form1 Submitted');

function submitAllForm() {

<form name="f1" method="post">
F1 NAME: <input type="text" name="t1" id="t1" size="24" value="txt1" />
<form name="f2" method="post">
F2 NAME: <input type="text" name="t2" id="t2" size="24" value="txt2" />
<input type="button" value="Submit" onClick="submitAllForm()" />

Its working properly in IE but not in Mozilla. do you have any idea ?


12-20-2007, 05:34 PM
Is there a compelling reason you are using two forms? Why not just use one form?

12-20-2007, 07:24 PM
Hi buddy,

Thanx for your reply. Im using two forms with separate tabs. I need to fill two tabs. so with one buttion i've to submit two forms thats why.

12-20-2007, 07:35 PM
And why can't the two tabs go under the umbrella of a single form? I'm just trying to make your life simple. Usually the only reason for more than one form is because you actually need them to submit separately, so when you use two forms that you need to submit together, it defeats the point of having two forms and just complicates matters.

12-20-2007, 07:38 PM
By 'having them in two tabs' do you mean that, depending on the answer to a particular question, the user either fills out one form or the other? If so, you can use one form and have two submit buttons (one in each tab) with the same name but different values. That way when the page loads, you can just parse the submit variable in PHP, performing one task for value A and another task for value B.

Hope this helps.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum