CheckboxList

Extends ListBase
Namespace Skybrud.Forms.Models.Fields
Type checkboxList

The CheckboxList is a custom field type representing a list of checkboxes.

If multiple checkboxes are checked when submitting the form, the field's value should be a comma separated list of the values of the checked checkboxes.

Properties

The class has the following properties:

C# Name C# Type JSON Name Description
Type string type Inherited from the FieldBase class.
The type of the field - generally matching the HTML type attribute, or a custom value for non-HTML fields.
Name string name Inherited from the FieldBase class.
The name of the field - matching the value for the HTML `name` attribute.
Label string label Inherited from the FieldBase class.
A friendly name that should accompany the field.
Description string description Inherited from the FieldBase class.
A description that should accompany the field.
IsRequired bool required Inherited from the FieldBase class.
Whether the field is required/mandatory.
Value object value Inherited from the FieldBase class.
An optional value of the field.
Items List<ListItem> items Inherited from the ListBase class.
The individual items making up the checkboxes of the checkbox list.

JSON Output

{
  "type": "checkboxList",
  "name": "myCheckBoxList",
  "label": "My checkbox list",
  "description": "A description for my checkbox list.",
  "required": true,
  "value": "1234",
  "items": [
    {
      "value": "1",
      "label": "1",
      "checked": false
    },
    {
      "value": "12",
      "label": "12",
      "checked": false
    },
    {
      "value": "123",
      "label": "123",
      "checked": false
    },
    {
      "value": "1234",
      "label": "1234",
      "checked": true
    },
    {
      "value": "12345",
      "label": "12345",
      "checked": false
    }
  ]
}