Hi, I have a form in rhtml. Now I have 2 buttons indside that form. Clicking on the first button action will be ''create'' & on second button action will be ''delete''. How to do this? Thanx Prash -- Posted via http://www.ruby-forum.com/.
On 3/14/06, Prashant Tiwari <tiwari_p_k@yahoo.com> wrote:> > I have a form in rhtml. Now I have 2 buttons indside that form. Clicking > on the first button action will be ''create'' & on second button action will > be ''delete''. How to do this?Probably the easiest way is to give up on the ''delete'' action being a button, and just making it a link. (You could use images or CSS to style the link and the button very similarly.) -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060314/ea5de489/attachment.html
Don''t know much about RoR, but it''s pretty simple actually ! <form method="POST" action=""> <input type="submit" value="Submit" name="B1"> <input type="submit" value="Submit" name="B2"> </form> if post->b1 ="submit" execute->action1 elseif post->b2 ="submit" execute->action2 Josh on Rails wrote:> On 3/14/06, Prashant Tiwari <tiwari_p_k@yahoo.com> wrote: >> >> I have a form in rhtml. Now I have 2 buttons indside that form. Clicking >> on the first button action will be ''create'' & on second button action will >> be ''delete''. How to do this? > > > Probably the easiest way is to give up on the ''delete'' action being a > button, and just making it a link. (You could use images or CSS to style > the > link and the button very similarly.)-- Posted via http://www.ruby-forum.com/.
stupid me sorry... just tired I guess <input type="submit" name="submit" value="v1"> <input type="submit" name="submit" value="v2"> <input type="submit" name="submit" value="v3"> if submit = v1 .... ..... ... -- Posted via http://www.ruby-forum.com/.
OKAY, just to be a nice guy template <%= form_tag(:action => "action2")%> <%= submit_tag ''Edit'', :name => ''_edit_button'' %> <%= submit_tag ''Delete'', :name => ''_delete_button'' %> <%= end_form_tag %> controller def action2 render_text params[:_update_button] end I hope it''s pretty self explainatory !!! Alex Copot wrote:> stupid me > sorry... just tired I guess > > <input type="submit" name="submit" value="v1"> > <input type="submit" name="submit" value="v2"> > <input type="submit" name="submit" value="v3"> > > if submit = v1 > .... > ..... > ...-- Posted via http://www.ruby-forum.com/.
OKAY - I''m an idiot for today template <%= form_tag(:action => "action2")%> <%= submit_tag ''Edit'', :name => ''_button'' %> <%= submit_tag ''Delete'', :name => ''_button'' %> <%= end_form_tag %> controller def action2 render_text params[:_button] end -- Posted via http://www.ruby-forum.com/.
<%=button_to "edit", :action=>"edit" %> <%=button_to "delete", :action=>"delete" %> See default scaffold for the "list" action view and change link_to to button_to -----Original Message----- From: rails-bounces@lists.rubyonrails.org [mailto:rails-bounces@lists.rubyonrails.org] On Behalf Of Josh on Rails Sent: Tuesday, March 14, 2006 6:20 AM To: rails@lists.rubyonrails.org Subject: Re: [Rails] How to provide 2 actions to a form? On 3/14/06, Prashant Tiwari <tiwari_p_k@yahoo.com> wrote: I have a form in rhtml. Now I have 2 buttons indside that form. Clicking on the first button action will be ''create'' & on second button action will be ''delete''. How to do this? Probably the easiest way is to give up on the ''delete'' action being a button, and just making it a link. (You could use images or CSS to style the link and the button very similarly.) -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060314/7ae807a0/attachment.html