Cant identify Multiple Submit Buttons in form_remote_tag


#1

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


#2

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.