Passing form variables

S

sindre

Hi,

I have a form with many fields. And then I thought I could have two other
forms similar but here is only the submit button visible.
What I want is: if the user click on a submit button on a hidden form the
information typed into the visible form is copied two the not
visible form and submitted.
This way I can submit the visible form to three pages depending on the form
submitted.

Is this possible?

Regards,

Sindre
 
M

McKirahan

sindre said:
Hi,

I have a form with many fields. And then I thought I could have two other
forms similar but here is only the submit button visible.
What I want is: if the user click on a submit button on a hidden form the
information typed into the visible form is copied two the not
visible form and submitted.
This way I can submit the visible form to three pages depending on the form
submitted.

Is this possible?

Regards,

Sindre
Perhaps a variation of the following?

<html>
<head>
<title>forms.htm</title>
<script type="text/javascript">
function submits() {
var form1 = document.form1;
var form2 = document.form2;
var form3 = document.form3;
form1.Field2.value = form2.Field2.value;
form1.Field3.value = form3.Field3.value;
return true;
}
</script>
</head>
<body>
<form name="form1" onsubmit="return submits()">
<input type="text" name="Field1" value="1">
<input type="hidden" name="Field2" value="1">
<input type="hidden" name="Field3" value="1">
<br><input type="submit" value="Submit Form">
</form>
<form name="form2">
<input type="hidden" name="Field2" value="2">
</form>
<form name="form3">
<input type="hidden" name="Field3" value="3">
</form>
</body>
</html>
 
S

sindre

Perhaps a variation of the following?

<html>
<head>
<title>forms.htm</title>
<script type="text/javascript">
function submits() {
var form1 = document.form1;
var form2 = document.form2;
var form3 = document.form3;
form1.Field2.value = form2.Field2.value;
form1.Field3.value = form3.Field3.value;
return true;
}
</script>
</head>
<body>
<form name="form1" onsubmit="return submits()">
<input type="text" name="Field1" value="1">
<input type="hidden" name="Field2" value="1">
<input type="hidden" name="Field3" value="1">
<br><input type="submit" value="Submit Form">
</form>
<form name="form2">
<input type="hidden" name="Field2" value="2">
</form>
<form name="form3">
<input type="hidden" name="Field3" value="3">
</form>
</body>
</html>

Thank you, that helped me a lot. I could use this, in a rewritten way.

Sindre
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top