-
Notifications
You must be signed in to change notification settings - Fork 27
6.3. DateTimePickerNFormView
This is a date and time picker view identified by type datetime_picker
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 |
type | The type of picker (date_picker or time_picker) | yes |
display_format | Format for display the date/time e.g. YYYY-MM-DD | yes |
min_date | Minimum date (Format: today-(number)[y or m or w or d] e.g today-5y minimum date will be five years ago | no |
max_date | Maximum date (Format: today+(number)[y or m or w or d] e.g today+5y maximum date will be five years from today | no |
For date piker
{
"name": "dob",
"type": "datetime_picker",
"properties": {
"hint": "Enter birth date",
"type": "date_picker",
"display_format": "dd/MM/yyyy",
"min_date": "today-80y",
"max_date": "today"
},
"required_status": "true:Please specify your dob"
}
For time picker
{
"name": "time",
"type": "datetime_picker",
"properties": {
"hint": "Enter time you clocked in",
"type": "time_picker",
"display_format": "hh:mm a"
},
"required_status": "true:Please specify the time you clocked in"
}
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 timestamp e.g result of a field dob
is a long value 1583504546374
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