views:

32

answers:

2

More specifically, I need to create <button type="submit">Foo</button> type markup in my Rails form. Is there a helper for that?

A: 
<%= submit_tag "Foo" %>

Here is the documentation for rails form helpers ActionView::Helpers::FormHelper.

ericmj
Actually that creates the following markup: <input type="submit" value="Subscribe" name="commit">
randombits
So you want the button outside of a form? Or, why would you want a button tag, does it have semantic meaning?
ericmj
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
+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