[Rails] Re: 2 submit buttons, how to identify which pressed in the controller?

2009-09-16 Thread sam
check params[:commit] if params[:commit] == 'first' else params[:commit] == 'second' end On Sep 15, 1:10 am, Matt mattbog...@gmail.com wrote: Hi I have the following code:             %= f.submit 'First', :class = mybutton, :myid= xx %             %= f.submit 'Second' % I would have

[Rails] Re: 2 submit buttons, how to identify which pressed in the controller?

2009-09-16 Thread Matt
Thank you all for your reply. The best was of course to check my console as I knew my variables were there before, no clue why I forgot about this. I am not scared to ask another question; I use a form_for to output the data fields of a class to the user, I receive this back as a param. What is

[Rails] Re: 2 submit buttons, how to identify which pressed in the controller?

2009-09-16 Thread pepe
If you have built your form from an instance variable you can get the screen values back into an object with: @my_object = MyClass.new(params[:my_object]) Then render the view and you should be done. On Sep 16, 9:10 pm, Matt mattbog...@gmail.com wrote: Thank you all for your reply. The

[Rails] Re: 2 submit buttons, how to identify which pressed in the controller?

2009-09-15 Thread Abhinav Saxena
Although I have never used two form submits in a single form, but perhaps you can use value to pass id instead of using params. Thanks, Abhinav -- अभिनव http://twitter.com/abhinav On Tue, Sep 15, 2009 at 12:40 PM, Matt mattbog...@gmail.com wrote: Hi I have the following code:

[Rails] Re: 2 submit buttons, how to identify which pressed in the controller?

2009-09-15 Thread Sijo Kg
Hi You can check params[:commit]In first case its value is 'First' and in second it is 'Second' Sijo -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on