# Cant identify Multiple Submit Buttons in form\_remote\_tag

**URL:** <https://www.ruby-forum.com/t/cant-identify-multiple-submit-buttons-in-form-remote-tag/49579>\
**Category:** Rails\
**Created:** [December 6, 2005, 12:59pm UTC](https://www.ruby-forum.com/t/cant-identify-multiple-submit-buttons-in-form-remote-tag/49579 "2005-12-06T12:59:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![prasad](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/9de0a6/32.png) [@prasad](https://www.ruby-forum.com/u/prasad)\
**Post date:** [December 6, 2005, 12:59pm UTC](https://www.ruby-forum.com/t/cant-identify-multiple-submit-buttons-in-form-remote-tag/49579/1 "2005-12-06T12:59:12Z")

</div>

Hi,  
Like Derek, I also found a bug in the form\_remote\_tag function.  
Whenever there are two or more Submit buttons, rails is not able to  
identify as to which Submit button has been clicked. On the otherhand  
Non-AJAX forms work perfectly. If possible please throw some light into  
this.

regards…  
Prasad  
Tr S/W Engineer,  
Genie Interactive

---

<div class="post-metadata">

**Author:** ![prasad](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/9de0a6/32.png) [@prasad](https://www.ruby-forum.com/u/prasad)\
**Post date:** [January 29, 2008, 6:52pm UTC](https://www.ruby-forum.com/t/cant-identify-multiple-submit-buttons-in-form-remote-tag/49579/2 "2008-01-29T18:52:52Z")

</div>

Surjya H. wrote:

> Hi,  
> Like Derek, I also found a bug in the form\_remote\_tag function.  
> Whenever there are two or more Submit buttons, rails is not able to  
> identify as to which Submit button has been clicked. On the otherhand  
> Non-AJAX forms work perfectly. If possible please throw some light into  
> this.
> 
> regards…  
> Prasad  
> Tr S/W Engineer,  
> Genie Interactive

Hi,  
If you have a form that calls for submisions to various functions then  
try the following code in your own way.  
\<%= hidden\_field\_tag(‘commit’, ‘add\_another\_criteria’) %\>  
\<%= submit\_tag(‘Add Another Search Term’, :name =\> ‘\_commit’) %\>  
\<%= submit\_tag(‘Generate Report’, :name =\> ‘\_commit’,  
:onclick =\> “Form.getInputs(this.form, null,  
‘commit’)[0].value = ‘Generate Report’”) %\>

Then in your method, check the params passed for each button click and  
depending on that you can do the server side programming.

Hope this helps.
