Hello gents, I''m building an enterprise web-site which contains: 1) a table with editable fields (checkboxes, textboxes, etc.) 2) multiple "buttons" which represent actions. How can I redirect from a particular button to a particualar action and get the values of all the controls on the form? I know that ASP.NET and Java create wrappers for the buttons and save the state of the controls in a hidden filed ViewState. Is there any way in RoR to do the same? Thanks in advance, Dmitry -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Nop Nop wrote:> Hello gents, > > I''m building an enterprise web-site which contains: > 1) a table with editable fields (checkboxes, textboxes, etc.) > 2) multiple "buttons" which represent actions. > > How can I redirect from a particular button to a particualar action and > get the values of all the controls on the form? > > I know that ASP.NET and Java create wrappers for the buttons and save > the state of the controls in a hidden filed ViewState. Is there any way > in RoR to do the same? > > Thanks in advance, > Dmitry >One way to do this would be to have 1 form and 1 action with a bunch of submit buttons. Rails helpers names submit buttons "commit" so in your controller you could switch on params[:commit] and call an appropriate method for your "action". -rm -- http://myutil.com/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
face wrote:> Nop Nop wrote: >> the state of the controls in a hidden filed ViewState. Is there any way >> in RoR to do the same? >> >> Thanks in advance, >> Dmitry >> > One way to do this would be to have 1 form and > 1 action with a bunch of submit buttons. > > Rails helpers names submit buttons "commit" so in > your controller you could switch on params[:commit] > and call an appropriate method for your "action". > > -rm > > -- > http://myutil.com/Could you please give an example on how to define such a submit button? Actually I need not a button but an image which submits the form following the onclick event. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Nop Nop Google is your friend. > 2) multiple "buttons" which represent actions. > .. > How can I redirect from a particular button to a particualar action and Look at "Multibutton Form" http://railscasts.com/episodes/38 All buttons will call the same action, but you''ll have a means to identify the pressed button. remark: it won''t work with AJAX request. In this case, use a hidden field and sets its value differently in each submit button "onclick". Alain Ravet --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---