将提交按钮添加到同一字段集作为formtastic中的输入

时间:2011-02-17 07:03:38

标签: ruby-on-rails-3 formtastic

如何将提交按钮添加到与表单输入相同的li中?

= semantic_form_for :regression_test_environments do |env|
  %ul.input-list
    = env.inputs :name, :navigation, :url, :title => "New Environment"
    %li.commit= env.submit "Save Environment", :class => "submit"

这只是将li置于字段集之外的类输入。有没有办法将它包含在fieldset(和ul)中?

1 个答案:

答案 0 :(得分:0)

这是否有效:

= semantic_form_for :regression_test_environments do |env|
  %ul.input-list
    = env.inputs :name => "New Environment" do
      = env.input :name
      = env.input :navigation, 
      = env.input :url 
      %li.commit= env.submit "Save Environment", :class => "submit"

我不确定您是否有字段:title,或者您想要为字段集命名(在这种情况下,您需要使用:name)。