ruby on rails - How can I get simple form to not wrap check_box in label tag -
how can simple form not wrap check_box in label tag
<%= simple_nested_form_for @project, url: project_path(@project), html: { id: "project-form", class: "form", } |f| %> <%= f.association :tasks, collection: task.options_for_select, as: :check_boxes, required: false %> <%= f.input :hold %> <% end %>
current result
<label for="task_ids_8"> <input class="check_boxes optional" type="checkbox" value="8" name="task_ids" id="task_ids_8">structure</label>
desired result
<label for="task_ids_8">structure</label> <input class="check_boxes optional" type="checkbox" value="8" name="task_ids" id="task_ids_8">
i need know how individual "hold" input , collection.
for one-off checkbox can use 1 of these:
<%= f.check_box :hold %>
or
<%= f.input_field :hold %>
as suggested here newer rails.
for collection can set boolean_style: :inline
according docs. other examples lean towards same thing different declarations.
use this:
<%= f.association :tasks, collection: task.options_for_select, as: :check_boxes, required: false, boolean_style: :inline %>
Comments
Post a Comment