문제

I have a form generated by scaffold in my _form.html.erb

<%= form_for @survey do |f| %>

  <%= f.label :name %><br />
  <%= f.text_field :name %>
  <%= f.submit "Send", class: "btn btn-red span3" %>

<% end %>

my submit input produces:

<input class="btn btn-red span3" name="commit" type="submit" value="Send">

I want to produce a button instead a input. Like this:

<button class="btn btn-red span3" name="commit" type="submit">Send</button>

Any tip?

도움이 되었습니까?

해결책 2

I discovered a simple way

<%= button_tag "Send", class: "btn btn-red span3", name: "commit" %>

produces:

<button class="btn btn-red span3" name="commit" type="submit">Send</button>

다른 팁

<%= content_tag :button, type: :submit, class: "btn btn-red span3" do %>
   Send
<% end %>

Produces following HTML

<button class="btn btn-red span3" type="submit">
   Send
</button>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top