Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Supported Field Types

Schema ValueAdditional Options
Text

Number

Password

TextArea

Checkbox
Select
Radio
Date

yearStart

First year in the list. Default: 100 years ago.

yearEnd

Last year in the list. Default: current year.

DateTime


Validation

typedescription
requiredChecks the field has been filled in.
numberChecks it is a number, allowing a decimal point and negative values.
rangeChecks 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.
emailChecks it is a valid email address.
urlChecks it is a valid URL.
matchChecks that the field matches another. The other field name must be set in the field option.
regexpRuns 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
languagejs
themeMidnight
{
    "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"
        }
    }
}