From 4338d45c2dd259226456efe0082370b75b7f011c Mon Sep 17 00:00:00 2001 From: Paul Callaghan Date: Tue, 12 Jul 2022 12:15:40 +0100 Subject: [PATCH] Add clarification re. hidden field and give example of include_hidden: --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index 5b73b0b8..962cfe07 100644 --- a/README.md +++ b/README.md @@ -262,6 +262,17 @@ the wrapper as well: <% end %> ``` +By default, **Simple Form** generates a hidden field to handle the un-checked case for boolean fields. +Passing `unchecked_value: false` in the options for boolean fields will cause this hidden field to be omitted, +following the convention in Rails. You can also specify `include_hidden: false` to skip the hidden field: + +```erb +<%= simple_form_for @user do |f| %> + <%= f.input :just_the_checked_case, as: :boolean, include_hidden: false %> + <%= f.button :submit %> +<% end %> +``` + **Simple Form** also allows you to use label, hint, input_field, error and full_error helpers (please take a look at the rdocs for each method for more info):