Hai everyone , I have a list of users(each user in a row)and an Approve button for each user. I wish to change the status of the user to be approved when I click on the Approve button of a user. When I tried getting all the users in the params hash. I want to get the id of the user according to which "Approve" button I clicked. How can I implement this one? Thanks in advance. -- 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 -~----------~----~----~----~------~----~------~--~---
First let me say that your question sounds stupid, because based on the info you''ve given us it would be simpler to use multiple forms. However, you need look no farther that the doc for submit_tag. http://api.rubyonrails.com/ -K -- 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 -~----------~----~----~----~------~----~------~--~---
(Woah there, I don''t think it sounds stupid. This is a pretty common sort of thing to want to do in HTML UIs - *without* a separate form for each. If you don''t know RoR, you wouldn''t think to have a single form for each user listed on the page or whatever; that''s not the way a proficient web developer would approach the problem in conventional HTML. ) I''m having a similar problem. I''m modifying Redmine. In a form to create a new bug/issue, there is currently a SUBMIT button to create the issue and a link to preview the issue. I want the link to be a button, instead. Here''s the code: <% labelled_tabular_form_for :issue, @issue, :html => {:multipart => true, :id => ''issue-form''} do |f| %> <%= error_messages_for ''issue'' %> <div class="box"> <%= render :partial => ''issues/form'', :locals => {:f => f} %> </div> <div class="submitrow"> <%= submit_tag l(:button_create), :class=> ''but mb'' %> <%= link_to_remote l(:label_preview), { :url => { :controller => ''issues'', :action => ''preview'', :project_id => @project }, :method => ''post'', :update => ''preview'', :with => "Form.serialize(''issue-form'')", :complete => "Element.scrollTo(''preview'')" }, :accesskey => accesskey(:preview), :class => ''but'' %> </div> <% end %> Yes, I can continue to muck with the CSS to get the link to exactly match the SUBMIT button, but I wondered if it''s possible to have the two SUBMIT buttons going to different actions and how to do it. I''m not a RoR developer; I''m a UI designer w/ a lot of HTMl/JS experience and I''m just trying to improve the usability of an existing (complex) RoR application and customize the look & feel for our site. Sadly, there''s no "RoR for UI Designers Cookbook" Thanks for any help. -- EB (The RoR documentation format is pretty weak, btw. No Search? Incidentally, when I google [submit_tag ruby on rails] I get http://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#M001394 which doesn''t document submit_tab. The RoR documentation site sucks -- no search?? the documentation for submit_tag is at http://api.rubyonrails.com/classes/ActionView/Helpers/FormTagHelper.html#M001537) On Dec 16, 12:03 am, Keynan Pratt <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> First let me say that your question sounds stupid, because based on the > info you''ve given us it would be simpler to use multiple forms. However, > you need look no farther that the doc forsubmit_tag.http://api.rubyonrails.com/ > > -K > -- > Posted viahttp://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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Dec 16, 6:17 pm, Ellen B <ellenbeld...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Yes, I can continue to muck with the CSS to get the link to exactly > match the SUBMIT button, but I wondered if it''s possible to have the > two SUBMIT buttons going to different actions and how to do it. I''mNot really. Going to the same url pretty much means it will be the same action. You can get the button clicked as a parameter (if i remember correctly via params[:commit] for a normal submit thing, or you can use <button> if you want the submitted parameter to be distinct from the label. Fred> not a RoR developer; I''m a UI designer w/ a lot of HTMl/JS experience > and I''m just trying to improve the usability of an existing (complex) > RoR application and customize the look & feel for our site. Sadly, > there''s no "RoR for UI Designers Cookbook" > > Thanks for any help. > > -- EB > > (The RoR documentation format is pretty weak, btw. No Search? > Incidentally, when I google [submit_tag ruby on rails] I gethttp://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html... > which doesn''t document submit_tab. The RoR documentation site sucks -- > no search?? > > the documentation for submit_tag is athttp://api.rubyonrails.com/classes/ActionView/Helpers/FormTagHelper.h...) > > On Dec 16, 12:03 am, Keynan Pratt <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > wrote: > > > First let me say that your question sounds stupid, because based on the > > info you''ve given us it would be simpler to use multiple forms. However, > > you need look no farther that the doc forsubmit_tag.http://api.rubyonrails.com/ > > > -K > > -- > > Posted viahttp://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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Please, correct me if I am wrong, but couldn''t you just assign a value to each submit button that means what you need in your application (and ID value, for example) then check the value from the params hash? Pepe On Dec 16, 2:18 pm, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Dec 16, 6:17 pm, Ellen B <ellenbeld...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Yes, I can continue to muck with the CSS to get the link to exactly > > match the SUBMIT button, but I wondered if it''s possible to have the > > two SUBMIT buttons going to different actions and how to do it. I''m > > Not really. Going to the same url pretty much means it will be the > same action. > You can get the button clicked as a parameter (if i remember correctly > via params[:commit] for a normal submit thing, or you can use <button> > if you want the submitted parameter to be distinct from the label. > > Fred > > > not a RoR developer; I''m a UI designer w/ a lot of HTMl/JS experience > > and I''m just trying to improve the usability of an existing (complex) > > RoR application and customize the look & feel for our site. Sadly, > > there''s no "RoR for UI Designers Cookbook" > > > Thanks for any help. > > > -- EB > > > (The RoR documentation format is pretty weak, btw. No Search? > > Incidentally, when I google [submit_tag ruby on rails] I gethttp://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html... > > which doesn''t document submit_tab. The RoR documentation site sucks -- > > no search?? > > > the documentation for submit_tag is athttp://api.rubyonrails.com/classes/ActionView/Helpers/FormTagHelper.h...) > > > On Dec 16, 12:03 am, Keynan Pratt <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > > wrote: > > > > First let me say that your question sounds stupid, because based on the > > > info you''ve given us it would be simpler to use multiple forms. However, > > > you need look no farther that the doc forsubmit_tag.http://api.rubyonrails.com/ > > > > -K > > > -- > > > Posted viahttp://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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
and then you could check the value of the submit button and send it to the right action: if params[:commit] == "foo" foo else bar end --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---