如何通过semantic_form_for?
设置表单元素的class和id属性以下代码:
<% semantic_form_for (@meetingsearch), :class => "new_meeting_search", :id => "meeting_search" do |f| %>
给了我:
<form action="/meetingsearches" class="formtastic meetingsearch" id="new_meetingsearch" method="post">
答案 0 :(得分:61)
这应该做你需要的(未经测试):
<% semantic_form_for @meetingsearch, :html => { :class => "new_meeting_search", :id => "meeting_search" } do |f| %>
为了澄清,semantic_form_for
包含了form_for
中内置的Rails',所以这正是您在regular Rails forms also中执行此操作的方式:
<% form_for @meetingsearch, :html => { class => "new_meeting_search", :id => "meeting_search" } do |f| %>