-
Notifications
You must be signed in to change notification settings - Fork 28
6.2. TextInputEditTextNFormView
This is a material design text input field that is identified by type text_input_edit_text
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 |
---|---|---|
hint | hint of the edit text | yes |
padding | padding to be applied on the edit text | no |
text_size | Size of the edit text | no |
text | Text shown on the edit text | no |
input_type | Specify any of the supported Android EditText input types e.g. (phone, number, text etc). NOTE: specify the type as declared in XML see Input type documentation | no |
{
"name": "adult_phone",
"type": "text_input_edit_text",
"properties": {
"hint": "Enter adult's phone number",
"type": "name",
"padding": "8"
},
"meta_data": {
"meta_one": "",
"meta_two": "",
"meta_three": ""
},
"validation": [
{
"condition": "value.length() <= 10",
"message": "value should be less than or equal to ten digits"
}
],
"subjects": "age:number, child:text",
"dependent_calculations": ["test", "decade"],
"required_status": "Yes:please add phone 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 as a primitive data type e.g result of a field age
is an integer
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