Checkbox

Checkbox

{{ checkbox }}

Represents a single true/false value.

Properties of {{ checkbox }} objects
Name Type Description
is_valid Boolean Will always be true
value String The value saved in the field - typically either "true" or "false". For checkbox fields you do not typically care about this - use checked instead
checked Boolean True if the checkbox was checked
field_id String The identifier for this field
label String The label for this field
output String "yes" or "no". . May include additional markup in the editor preview to make it easier to edit content

Related

boolean

True or False

{{ checkbox_field }}

Should be used to display a checkbox field inside a form.

{{ checkbox_field }}

Should be used to display a checkbox field inside a form.

Properties of {{ checkbox_field }} objects
Name Type Description
is_valid Boolean Will always be true
type String Will always be "checkbox"
default_value Boolean Whether or not the checkbox should be checked by default when the form is displayed
map_to_attribute String If the user is signed into a profile when they submit this form and map_to_attribute is set, the profile attribute specified in map_to_attribute will be set to "true" or "false". This should also be used to override the default value if the user is signed into a profile and the specified attribute has already been set
required Boolean Will be true if the user is required to check this checkbox before submitting the form
required_message String The message to display when the user attempts to submit the form without checking this checkbox
element_id String A helper property containing a unique ID for this field on this instance of this form. This value should be different every time the form is output
subtext text Help or hint text to display together with the field
condition condition The condition that should be used to show and hide this form field
classname String CSS class name(s) to be applied to the field
field_id String The identifier for this field
label String The label for this field
output String Default HTML markup for this field, which makes a number of assumptions about other elements on the page that may or may not be included. Developers should avoid using the default output in order to guarantee that forms work as expected, including styling, validation, conditionals, and more. May include additional markup in the editor preview to make it easier to edit content

Related

{{ checkbox }}

Represents a single true/false value.

{{ form_field }}

{{ label_field }}

Should be used to display a text label inside a form.

{{ form }}

{{ submit_field }}

Should be used to display a submit button inside a form.

{{ checkboxlist_field }}

Should be used to display a list of checkboxes inside a form.

{{ textarea_field }}

Should be used to display a textarea field inside a form.

{{ text }}

{{ hidden_field }}

Should be used to output a hidden field inside a form, which by definition is not displayed to or directly editable by users.

string

Can be any text, from the empty string ("") to the full HTML output of the template. When used alone in a conditional, all strings evaluates as true - even if they are empty or a value such as "0" or "false".

{{ date_field }}

Should be used to display a date field inside a form.

{{ select_field }}

Should be used to display a select list inside a form.

{{ button_field }}

Should be used to display a custom button inside a form.

{{ captcha_field }}

Should be used to display a captcha inside a form.

{{ profile }}

{{ condition }}

Represents the condition that should be used to show and hide form fields.

{{ file_field }}

Should be used to display a file upload field inside a form.

{{ time }}

Represents a specific instant in a specific timezone.

{{ radio_field }}

Should be used to display a radio field inside a form.

{{ text_field }}

Should be used to display a text field inside a form.

Examples

Demonstrates how to check if Toggle field is on.

Check if Toggle field is on

Copy
<p>Show subscriptions? <strong>{{ entity.show_subscription_form }}</strong></p>
{% if entity.show_subscription_form.on %}
{% include "Subscription Form" %}
{% endif %}

Demonstrates how to checkbox Include Partial Template.

Checkbox Include Partial Template

Copy
<p>Show Sidebar? <strong>{{ page.show_sidebar }}</strong></p>
{% if page.show_sidebar.checked %}
{% include "Sidebar" %}
{% endif %}