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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is it possible to have 3 submit buttons in one frame or one submit...

Status
Not open for further replies.

GraciePoo

Technical User
Mar 16, 2001
15
US
Is it possible to have 3 submit buttons in one frame or one submit button for 3 forms?

Or neither?

I have a frame set set up. There is a top frame called "yup" across the top and three frames lined up next to each other below that frame. Respectively, their names are "one", "two" , and "three". I have a drop down menu in the "yup" frame. The user makes a selection and I want to be able to send that selection to each of the three frames.

However, there are three different forms that need to be processed here, one for each of the three frames. What I'm wondering about is if it's possible to set up a submit button that will do what I outlined above. If that's not doable, can the "yup" frame be setup with 3 submit buttons, with each submit button handling one of the frames.

I did some digging before and some people said that this is a javascript field. I am really trying to avoid that path. However as a last resort, I could try it.

Bare in mind that I have no knowledge of javascript so you'd have to hold my hand on this one. :(

::Looking forward to replies::
 
-> yes, you CAN have 3 submit buttons in 1 form, or 1 for 3 forms ... but (this is a very personnal advice) i think that if you need this, then you mis-designed something - i mean, by re thinking your app you should be able to find a "simple" way to do stuff - or else, your app is not clear in your mind (or in your client's mind)
-> now, your point is : you have a select field in the "yup" frame and when selecting a value, you want this value to be sent to the 3 other frames - right ?
----
in the 3 "other" frames, we'll set up a field which will receive the selected value - it's a hidden field :
<form name=other_form ...>
....
<input field=hidden name=receiver>
...
</form>
(you have to write this 3 times : one in each frame)
----
in the &quot;yup&quot; frame, we'll first write the select, and tell it to call a function (&quot;updater&quot;, the one that will update the fields) as soon as the user chooses a value (that is the &quot;onchange&quot; part) :
<form name=yup_form ...>
...
<select name=selectbox onchange=&quot;javascript:updater()&quot;>
<option...>...</option>
..
</select>
..
</form>

and now the &quot;updater&quot; function (place it between the <script> </script> tags in your page)
function updater(){
// the selected value :
var selected_value=document.yup_form.selectbox.options[document.yup_form.selectbox.selectedIndex].value;
// update hidden field for frame &quot;one&quot;
top.one.document.other_form.receiver.value=selected_value
// for frame &quot;two&quot;
top.two.document.other_form.receiver.value=selected_value
// and &quot;three&quot;
top.three.document.other_form.receiver.value=selected_value
}





 
X-) To send multiple forms with one submit button, give each form its own name, then use an onclick command linked to a function containing multiple submit commands:

<script language=&quot;javascript&quot;>
function submitForms(){
firstform.submit(); //or document.forms[1].submit();
secondform.submit(); //or document.forms[2].submit();
}

Then:

<input type=&quot;button&quot; name=&quot;submit&quot; value=&quot;Send Forms&quot; onclick=&quot;submitForms()&quot;>
 
Isn't the first form forms[0]? Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top