More specifically, I need to create <button type="submit">Foo</button>
type markup in my Rails form. Is there a helper for that?
views:
32answers:
2
A:
<%= submit_tag "Foo" %>
Here is the documentation for rails form helpers ActionView::Helpers::FormHelper.
ericmj
2010-07-18 22:32:24
Actually that creates the following markup: <input type="submit" value="Subscribe" name="commit">
randombits
2010-07-18 22:34:02
So you want the button outside of a form? Or, why would you want a button tag, does it have semantic meaning?
ericmj
2010-07-18 22:37:17
nope, I want the button inside of the form, exactly how it is above. I could use just regular HTML, but was wondering if Rails had a facility also for doing this.
randombits
2010-07-18 22:38:44
+2
A:
Nope, you could obviously do in HTML, or
<%= content_tag(:button, "Foo", :type=>:submit)%>
But if you want to do the following then check out Rails Button Tag :
<%= button_tag "Foo"%>
Jesse Wolgamott
2010-07-19 02:03:11