check_box_tag(name, value = "1", checked = false, options = {})
Instance Public methods
Creates a check box form input tag.
Options
-
:disabled
- If set to true, the user will not be able to use this input. -
Any other key creates standard HTML options for the tag.
Examples
check_box_tag 'accept' # => <input id="accept" name="accept" type="checkbox" value="1" /> check_box_tag 'rock', 'rock music' # => <input id="rock" name="rock" type="checkbox" value="rock music" /> check_box_tag 'receive_email', 'yes', true # => <input checked="checked" id="receive_email" name="receive_email" type="checkbox" value="yes" /> check_box_tag 'tos', 'yes', false, class: 'accept_tos' # => <input class="accept_tos" id="tos" name="tos" type="checkbox" value="yes" /> check_box_tag 'eula', 'accepted', false, disabled: true # => <input disabled="disabled" id="eula" name="eula" type="checkbox" value="accepted" />
Please login to continue.