Checkbox List Field

Checkbox List Field

Form Field

The checkboxlist field renders a list of checkboxes. Checkbox lists support the same methods for defining the options as the dropdown field type and also support secondary descriptions, found in the radio field type.

permissions:
    label: Permissions
    type: checkboxlist
    options:
        open_account: Open account
        close_account: Close account
        modify_account: Modify account

The following field properties are supported and commonly used.

Property Description
label a name when displaying the form field to the user.
options available options for the list, as an array.
optionsMethod take options from a method defined on the model or as a static method, eg Class::method.
default a default value to use for new records.
quickselect show the quick selection buttons.
cssClass used for setting the options as inline.
inlineOptions display the options side-by-side instead of stacked, when less than 10 options.
placeholder a message to display when there are no records selected (preview context).
cumulative when checkboxes are nested, checking a parent will check all the children. Default: false

You may use the default property to set a default value, where the value is the key of the option.

permissions:
    label: Permissions
    type: checkboxlist
    default: open_account

Options can be displayed inline with each other instead of in separate rows by setting the inlineOptions property to a true value. This only applies when there are less than 10 available options.

permissions:
    type: checkboxlist
    inlineOptions: true

A quick select menu with "Select All" and "Select None" buttons will become visible when the list has greater than 10 items. To explicitly enable these buttons, use the quickselect option.

permissions:
    type: checkboxlist
    quickselect: true

When using detailed options the checkboxes can appear in a nested structure, set the cumulative property to true if you want to check all child checkboxes when a parent checkbox is selected.

permissions:
    type: checkboxlist
    cumulative: true

# See Also

On This Page