Hi all, I am new to ruby/rails and want to use a normal button - not a submit button - as a link. But I also want to use a css style on that button. My idea was this: <%= button_to "Add New Client", :action => ''new'', :class => ''button'' %> where "button" is my css style this will result into: <form method="post" action="/client/new?class=button" class="button-to"><div><input type="submit" value="Add New Client" /></div></form> I wonder if there is any better way to do it and to set a css style to my button. Thanks for any help or hint -Andreas -- 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 -~----------~----~----~----~------~----~------~--~---
Andreas Schneider wrote:> I am new to ruby/rails and want to use a normal button - not a submit > button - as a link. But I also want to use a css style on that button. > > My idea was this: > <%= button_to "Add New Client", :action => ''new'', :class => ''button'' %> > where "button" is my css style > > this will result into: > <form method="post" action="/client/new?class=button" > class="button-to"><div><input type="submit" value="Add New Client" > /></div></form>You need to add some curly braces to separate the url and options hashes, otherwise Ruby treats the list of key-values as all part of the url hash. <%= button_to "Add New Client", {:action => ''new''}, :class => ''button'' %> -- We develop, watch us RoR, in numbers too big to ignore. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Andreas Schneider wrote:> Hi all, > > I am new to ruby/rails and want to use a normal button - not a submit > button - as a link. But I also want to use a css style on that button. > > My idea was this: > <%= button_to "Add New Client", :action => ''new'', :class => ''button'' %> > where "button" is my css style > > this will result into: > <form method="post" action="/client/new?class=button" > class="button-to"><div><input type="submit" value="Add New Client" > /></div></form> > > I wonder if there is any better way to do it and to set a css style to > my button. > > Thanks for any help or hint > -AndreasI''m not an HTML or CSS jock, but remember this...you''re not required to use the Rails helpers in your rhtml files. Use whatever works the best. If that is straight ahead html, then there''s nothing wrong with that. Use the helper only if it "helps". jp -- 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 -~----------~----~----~----~------~----~------~--~---