# Help getting multiple submit buttons working in Internet Exp

**URL:** <https://www.ruby-forum.com/t/help-getting-multiple-submit-buttons-working-in-internet-exp/114477>\
**Category:** Rails\
**Created:** [September 13, 2007, 2:27am UTC](https://www.ruby-forum.com/t/help-getting-multiple-submit-buttons-working-in-internet-exp/114477 "2007-09-13T02:27:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![anthonyrudgick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c37758/32.png) [@anthonyrudgick](https://www.ruby-forum.com/u/anthonyrudgick)\
**Post date:** [September 13, 2007, 2:27am UTC](https://www.ruby-forum.com/t/help-getting-multiple-submit-buttons-working-in-internet-exp/114477/1 "2007-09-13T02:27:39Z")

</div>

Hi,

I using multiple submit buttons with a form and need to determine which  
button was used for the form submission back in the controller. This  
works fine in Firefox, but I can;t seem to get it to work with Internet  
Exploder … ooops… Explorer.

Note: I’m using no Javascript and can’t use and javascript  
(accessability reasons) so bog standard xhtml solution needed.

HTML (entire file):

 Add Phone Number Save 

Office

Mobile

With Firefox I get the following parameters return to my controller:  
Press “Add Phone Number” button:

- Parameters: {“phone\_numbers”=\>{“1”=\>{“external\_number”=\>“1234”},  
“2”=\>{“external\_number”=\>“5678”}}, “\_method”=\>“put”, “action”=\>“update”,  
“controller”=\>“work”, “person\_id”=\>“1”, “submitbutton”=\>“add\_phone”}  
Press “Save” button:
- Parameters: {“phone\_numbers”=\>{“1”=\>{“external\_number”=\>“1234”},  
“2”=\>{“external\_number”=\>“5678”}}, “\_method”=\>“put”, “action”=\>“update”,  
“controller”=\>“work”, “person\_id”=\>“1”, “submitbutton”=\>“save\_all”}

So because the parameter “submitbutton” shows the value for pressed  
button it’s easy to work out what to do.

However in Internet Explorer 6 I get the following result:  
Press “Add Phone Number” button:

- Parameters: {“phone\_numbers”=\>{“1”=\>{“external\_number”=\>“1234”},  
“2”=\>{“external\_number”=\>“5678”}}, “\_method”=\>“put”, “action”=\>“update”,  
“controller”=\>“work”, “person\_id”=\>“1”, “submitbutton”=\>“Add Phone  
Number”}  
Press “Save” button:
- Parameters: {“phone\_numbers”=\>{“1”=\>{“external\_number”=\>“1234”},  
“2”=\>{“external\_number”=\>“5678”}}, “\_method”=\>“put”, “action”=\>“update”,  
“controller”=\>“work”, “person\_id”=\>“1”, “submitbutton”=\>“Add Phone  
Number”}

Oh no … it’s the same value returned each time regardless of the  
button. It always returns the text of the first submit button,  
regardless of the button actually pressed. If you change the order of  
the buttons the new first buttons text will be returned. It doesn’t even  
return the value, it returns the text, go figure.

I tried some other combinations:  
Add  
Phone Number  
Save

In firefox:

- Parameters: {“phone\_numbers”=\>{“1”=\>{“external\_number”=\>“1234”},  
“2”=\>{“external\_number”=\>“5678”}}, “\_method”=\>“put”, “action”=\>“update”,  
“add\_phone\_button”=\>“add\_phone”, “controller”=\>“work”, “person\_id”=\>“1”}  
The button that was pressed is included in the parameters, the button  
that was not pressed is not included in the parameters.

In Internet Explorer:

- Parameters: {“save\_all\_button”=\>“Save”,  
“phone\_numbers”=\>{“1”=\>{“external\_number”=\>“1234”},  
“2”=\>{“external\_number”=\>“5678”}}, “\_method”=\>“put”, “action”=\>“update”,  
“add\_phone\_button”=\>“Add Phone Number”, “controller”=\>“work”,  
“person\_id”=\>“1”}  
Both buttons and there text are included in the parameters, so you can’t  
tell which was pressed.

In Internet Explorer 7 it will return the title of button that was  
clicked (when both buttons are named the same). When the buttons are  
named different it only returns the button that was clicked. (So very  
much like FireFox)

So the question is, in Internet Explorer 6, how do I tell which submit  
button was pressed when a form has more than one submit button. I  
real;ise I could work around this with javascript, but I need this to  
work when javascript is disabled.

Cheers,

Anthony R.

---

<div class="post-metadata">

**Author:** ![anthonyrudgick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c37758/32.png) [@anthonyrudgick](https://www.ruby-forum.com/u/anthonyrudgick)\
**Post date:** [September 13, 2007, 2:45am UTC](https://www.ruby-forum.com/t/help-getting-multiple-submit-buttons-working-in-internet-exp/114477/2 "2007-09-13T02:45:27Z")

</div>

wow… hmm, well, go to ever computer that is going to use this app  
and hit it with a baseball bat, then leave a note that says buy a mac  
and hope no one catches you. Good luck!

🙂

---

<div class="post-metadata">

**Author:** ![anthonyrudgick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c37758/32.png) [@anthonyrudgick](https://www.ruby-forum.com/u/anthonyrudgick)\
**Post date:** [September 13, 2007, 3:02am UTC](https://www.ruby-forum.com/t/help-getting-multiple-submit-buttons-working-in-internet-exp/114477/3 "2007-09-13T03:02:41Z")

</div>

Jeremy W. wrote:

> wow… hmm, well, go to ever computer that is going to use this app  
> and hit it with a baseball bat, then leave a note that says buy a mac  
> and hope no one catches you. Good luck!

he he he … I almost deleted by Windows Virtual Machine out of  
frustration. 🙂

Maybe I can use a Internet Explorer exploit to download and install  
Firefox on the machine. 🙂

---

<div class="post-metadata">

**Author:** ![anthonyrudgick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c37758/32.png) [@anthonyrudgick](https://www.ruby-forum.com/u/anthonyrudgick)\
**Post date:** [September 13, 2007, 4:23am UTC](https://www.ruby-forum.com/t/help-getting-multiple-submit-buttons-working-in-internet-exp/114477/4 "2007-09-13T04:23:49Z")

</div>

Hi,

It seems if I change from using tags to tags IE6  
updates the value correctly to match the button pressed.

e.g.

Return Parameter:

- Parameters: {“phone\_numbers”=\>{“1”=\>{“external\_number”=\>“1234”},  
“2”=\>{“external\_number”=\>“5678”}}, “\_method”=\>“put”, “action”=\>“update”,  
“controller”=\>“work”, “person\_id”=\>“1”, “submitbutton”=\>“Save All”}

and with different names:

Return

- Parameters: {“phone\_numbers”=\>{“1”=\>{“external\_number”=\>“1234”},  
“2”=\>{“external\_number”=\>“5678”}}, “\_method”=\>“put”, “action”=\>“update”,  
“controller”=\>“work”, “submitbutton2”=\>“save\_all”, “person\_id”=\>“1”}

IE6 only returns the selected button.

Few, at least I can move forward. Just have to work within the less  
flexible constraints of the tag over the more flexible ,  
damn. At least I can make it work for accessibility and use unobtrusive  
javascript to patch up the html client side if required for look/feel

Cheers,

Anthony R.
