4

我正在尝试实现与此http://foundation.zurb.com/docs/components/switch.html 不太相似的结果?使用 Foundation 5 开关类

我遇到的问题是 simple_form 创建了一个具有相同名称的隐藏输入,所以当我使用以下代码时,我没有达到预期的结果

= simple_form_for(@team_setting) do |f|
  = f.error_notification
  .form-inputs
    .switch
      = f.label :arrive_time, 'On'
      = f.input_field :arrive_time, boolean_style: :inline
      %span

我得到了以下HTML

<div class="switch">
    <label for="team_setting_arrive_time">On</label>
    <input name="team_setting[arrive_time]" type="hidden" value="0"><input boolean_style="inline" class="boolean optional" id="team_setting_arrive_time" name="team_setting[arrive_time]" type="checkbox" value="1">
    <span></span>
</div>
4

0 回答 0