Checkbox
Checkbox fields in forms allow users to select one or more options from the list of options provided. A list of attributes passed for this field are given below. All the mandatory parameters are indicated with a '*' and the maximum characters allowed is provided with the Data Type.
Attribute Name | Datatype | Description |
type* | String (Value should be checkbox) | The type of the input field. Value of the field should be checkbox. |
name* | String (50) | A unique identifier for the field. Upon form submission, value defined for this key will be available in the function associated with the form. |
label* | String (150) | Describes the display name for this field. |
hint | String (100) | Provides a brief description of the fields purpose and the expected input. |
max_selections | Int (Value must be >0 and < the number of options in the option array) | Specifies the maximum number of selections that the user can make. |
min_selections | Int (Value must be >0 if the mandatory key is set to true) | Specifies the minimum number of selections that the user can make. |
options* | Array | An array of JSON object following the structure label and value. Label indicates the display text for each checkbox and value represents the value associated with each checkbox option. Note: The maximum number of options allowed is 100. FORMAT: { label: $label, (Maximum allowed characters: 100) } |
value | String(50) | Provide a default input value for the field. This should be same as the values defined in the options array. You can pass multiple values separated by commas. |
mandatory | Boolean | Defines if the field's requisite is mandatory or not. Note: Default value is considered to be false. |
disabled | Boolean | If disabled is true, then the field will not be editable |
trigger_on_change | Boolean | If this is enabled for a field or an input, then the change handler will be invoked when the value of that field is changed |
Sample Code:
Copied{
"type":"checkbox",
"name":"productdetails",
"label":"Product Details",
"hint":"Select the products that you would like to buy from our website",
"value":"wardrobes",
"mandatory":false,
"trigger_on_change":true,
"options":[
{
"label":"Beds",
"value":"beds"
},
{
"label":"Wardrobes",
"value":"wardrobes"
},
{
"label":"Bookshelves",
"value":"bookshelves"
}
],
"max_selections":2,
"disabled" : true,
"min_selections":0
}
JSON format passed in handlers for the filled-in value:
Copied{
"meta":{
"type":"checkbox",
"value":"deal"
},
"value":[
{
"label":"Add Deal",
"value":"deal"
}
]
}