Click to See Complete Forum and Search --> : Form Question


mortehl
10-20-2003, 03:43 PM
Hi there,

I have a problem:

I have 3 seperate forms on the same HTML page, that all have 1 common text input field.

How can I do something like this:

Test: <input type='text' name='test' value=''>
<p>
<form method='post' action='www.myserver1.com/form.php'>
<input type='submit' value='Submit'>
</form>
<p>
<form method='post' action='www.myserver2.com/form.php'>
<input type='submit' value='Submit'>
</form>
<p>
<form method='post' action='www.myserver3.com/form.php'>
<input type='submit' value='Submit'>
</form>


Whenever someone clicks on any of the 3 forms, I want it to submit as part of the form any the text field above the forms.

Any idas?

Phil Karras
10-20-2003, 04:03 PM
Have you tried something like:

.
.
.
function CheckWhich(frm) {
if(frm.indexOf("m1") != -1) {
document.Form1.action = 'http://www.myserver1.com/form.php';
document.Form1.submit();
}
else if(frm.indexOf("m2") != -1) {
document.Form2.action = 'http://www.myserver2.com/form.php';
document.Form2.submit();
}
else if(frm.indexOf("m3") != -1) {
document.Form3.action = 'http://www.myserver3.com/form.php';
document.Form3.submit();
}

}
.
.
.
<form name='Form1' action='#' onSubmit="return CheckWhich('Form1');">
.
.
.
<form name='Form2' action='#' onSubmit="return CheckWhich('Form2');">
.
.
.
<form name='Form3' action='#' onSubmit="return CheckWhich('Form3');">
.
.
.

?
I do know that this works. Tested 10/20/03 17:15 EDST