Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gmmastros on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

1 Submit Button for 2 forms

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
0
0
I'm wondering if it's possible to have 1 submit button for two forms? Can you go:

<form = xyz.cgi>
Input fields
</form>

<form = xyz.cgi (the same script)
Input fields
</form>

Input stype=submit>

Is is possible to submit all the input values with 1 button? or as you end forms, do you have to submit? - Is there a way around if not possible this way?

Thanks for the expertise!

JOE
 
As you have to wrap the buttons:

<input type=&quot;submit&quot; value=&quot;Submit&quot;>
<input type=&quot;reset&quot; value=&quot;Reset&quot;>

in the ending form tag </form> there is no way to have that one submit button submit something for two separate forms (<form></form>). However, you can process the on_click event in javascript and post the necessary data to the appropriate perl script. I HAD code for this back in my web days but cannot find it. I haven't done web stuff in a long while so I can't remember exactly how to do this. Hm, you could also just submit all the data to a dummy perl script which then sends it to the &quot;right&quot; script for processing. I don't know just try a bunch of stuff until you get it. :)

Good Luck (sorry I wan't a huge help),
bitwise
 
Actually, there is basically no reason to have 2 form fields. You could just use

<FORM ACTION=&quot;xyz.cgi&quot; METHOD=&quot;POST&quot;>
input fields
<INPUT TYPE=&quot;submit&quot; VALUE=&quot;Submit&quot;>
</FORM>

There is no reason that I can see to have 2 different ones, just put them all in the same form action. - Ben Russell
- President of Intracor Technologies (
 
Oh yeah, I didn't even notice you had the same exact script for the two forms! What is the problem? Everything wrapped between <form> and </form> will be sent to the xyz.cgi script. This is default behavior. I thought you were asking something more complicated.

bitwise
 
Actually, I didn't put it in - but the reason I'm ending the form is b/c I have another form (different one) in betwee, - it's a 3D array for categorizing entries into a database, and is another form unto itself. So - I define values for 1 form, and then the other value the database entry come from the array. So it actually looks like this:

<form = xyz.cgi>
Input fields
</form>

<form = 3D array)
javascript form
input other fields for the same database entry
</form>

<form = xyz.cgi (the same script)
Input fields
</form>

I'm trying to use javascript to pass the values between forms - but to no avail - any more suggestions would be great! - Thanks

Joe
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top