-
Notifications
You must be signed in to change notification settings - Fork 29
6.4. CheckBoxNFormView
This is a checkbox view that is identified by type checkbox in the JSON.
All JSON attributes are represented as a String literals
| Field Attribute | Usage | Required |
|---|---|---|
| name | Name of the field | yes |
| type | Type of the field | yes |
| properties | View attributes | yes |
| meta_data / metadata | Extra data passed with the result of this field | no |
| validation | List of validations to perform on the field | no |
| required_status | Status to indicate whether this field is required or not | no |
| subjects / binding_fields | no | |
| calculations / dependent_calculations / calculation_fields | Calculations depending on this field | no |
Mostly matching the attributes on the XML but using snake case.
| View Attribute | Usage | Required |
|---|---|---|
| text | Label of the the checkbox | yes |
| text_size | Size of the checkbox options | no |
{
"name": "email_subscription",
"type": "checkbox",
"properties": {
"text": "Subscribe to email notifications"
},
"required_status": "no:Please specify if you want subscription",
"subjects": "age:number"
}
Validations are executed by Rules Engine in the order they are added on the list. To access the value of the field in the rules file, you can use a special neat form keyword called value alternatively you can use the field name. A field becomes invalid when any of the listed validation fails.
A validation has a condition and error message to be displayed on the view when the condition evaluates to false.
This field stores value of a map of the field_name -> checkbox_label
To make field required add required_status attribute with value Yes:error message or true:Your error message. Use no/false to negate the status
Add field:data_type to comma separated string list of the subjects / binding_fields attribute. as shown in the sample JSON above. For calculations add field names to the JSON array of dependent_calculations / calculation / calculation_fields attribute to watch for changes in the value of the view.
Created by Elly Nerdstone with the help of some awesome contributors. License Apache 2.0