Form_for in Rails 3 is considering only the first submit button wth Form.serialize(this) in AJAX request -


i'm working on rails 3 app. 1 of view had 1 submit button , i'm supposed add 1 more. have done necessary changes in view file (.html.erb) , in controller.rb. considers first button (whichever is) when either clicked.

why taking first button consideration?? , how can make both work??

edited: checked railscast video
http://railscasts.com/episodes/38-multibutton-form?autoplay=true

it talks multibutton forms n mentions changes done if form has ajax request , form serialization. code has them!!

here's code

added submit button calls earlier button's function itself

can plsss me make necessary changes serialization both buttons considered!!

you can add name submit button in view, this:

= submit_tag 'done', :class => 'btn', :name => "done" = submit_tag 'save', :class => 'btn', :name => "save" 

and controller:

if params[:done]   # done elsif params[:save]   # save end 

if click "done" button, controller work "done".

and want lean more, can watch railscasts: http://railscasts.com/episodes/38-multibutton-form?autoplay=true


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -