...
Supported Field Types
Schema Value | Additional Options |
---|---|
Text | |
Number | |
Password | |
TextArea | |
Checkbox | |
Select | |
Radio | |
Date |
First year in the list. Default: 100 years ago.
Last year in the list. Default: current year. |
DateTime |
Validation
type | description |
---|---|
required | Checks the field has been filled in. |
number | Checks it is a number, allowing a decimal point and negative values. |
range | Checks it is a number in a range defined by min and max options. Message if it is not a number can be set with the numberMessage option. |
Checks it is a valid email address. | |
url | Checks it is a valid URL. |
match | Checks that the field matches another. The other field name must be set in the field option. |
regexp | Runs a regular expression. Requires the regexp option, which takes a compiled regular expression or a string value. Setting the match option to false ensures that the regexp does NOT pass. |
...
Code Block | ||||
---|---|---|---|---|
| ||||
{
"label": "Customer Data",
"description": "Edit in conf/form_schemas/opCharts_element_inventory_customer.json",
"component": ["element_lists"],
"tags": ["interface"],
"schema": {
"customerId": {
"label": "Customer ID",
"type": "Text"
},
"upStream": {
"label": "Upstream Contract Speed",
"type": "Number",
"validators": [
{ "type": "range", "min": 1, "max": 10000, "message": "Mbps should be between 1 and 10000" }
]
},
"downStream": {
"label": "Downstream Contract Speed",
"type": "Number",
"validators": [
{ "type": "range", "min": 1, "max": 10000, "message": "Mbps should be between 1 and 10000" }
]
}
}
} |
Example for adding Maintenance Tracking to entityMib Data
The following is an example form schema so you can track the maintenance renewals of your serial number items using opCharts Element Lists.
The following would be located in /usr/local/omk/conf/form_schemas and in testing was named opCharts_element_lists_serial_numbers.json
Code Block |
---|
{ "label": "Serial number tracking for EntityMIB Data", "description": "Edit in conf/form_schemas/opCharts_element_lists_serial_numbers.json", "component": ["element_lists"], "tags": ["entityMib"], "schema": { "under_maintenance": { "label": "Under Maintenance", "help": "Do we have a maintenance contract for this element or not?", "type": "Select", "options": ["","Yes", "No"] }, "maintenance_contract": { "label": "Maintenance Contract", "type": "Text" }, "start_date": { "label": "Start Date", "yearStart": 2010, "yearEnd": 2030, "type": "Date" }, "renewal_date": { "label": "Renewal Date", "yearStart": 2020, "yearEnd": 2050, "type": "Date" } } } |