-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Datatypes
Datatypes are functions to dynamically validate the user input on the client side using Javascript.
A datatype is defined as a
- Standard validation:
- Validation with arguments:
- Combination of a meta type and mixed types and strings:
Makes it possible to validate against one or more datatypes in the same field.
Example usage:
- Would allow using integers from 0 to 2048, no decimals.
Makes it possible to use different datatypes in the same field.
Example usage:
- Would allow using -1, a positive number except from 0 to 29 and allow the term infinity to be used.
Allow using an exclamation mark in front of the value.
Example usage:
Allow the usage of a space separated multi-value.
Verify if the value is either 1, yes, on, true or 0, no, off, false.
Example:
Verify if the value is a positive (unsigned) number and doesn't contain decimals.
Example:
Verify if the value is a number doesn't contain decimals.
Example:
Verify if the value is a positive number.
Example:
Verify if the value is a number.
Example:
Verify if the value is an IP address, either IPv4 or IPv6.
Verify if the value is an IPv4 address.
Example:
Verify if the value is an IPv4 address and allow to add a mask.
Example:
Verify if the value is an IPv6 address.
Example:
Verify if the value is an IPv6 address and allow to add a mask.
Example:
Verify if the value is a port between 0 and 65535.
Example:
Verify if the value contains one or more port separated by a dash.
Example:
Verify if the value is a valid MAC address separated by colons. The address may contain uppercase and lowercase hexadecimal characters.
Examples:
Verify if the value is a valid DNS domain name or hostname. The hostname can contain uppercase and lowercase alphanumerical characters, underscore, dash and dots. Hostname cannot start with a dash or end with a dot.
Example:
Verify if the value is a valid hostname or IP address.
Example:
Same as host but also allows UCI network names found in the Network, Interfaces page.
Example:
Verify if the value is a valid WPA pre-shared key, from 8 to 63 characters or a valid WPA key containing exactly 64 hexadecimal characters.
Example:
Verify if the value is a valid 40 bits or 104 bit WEP key or string. If the WEP key is defined as a string, it must start with s: and contain either 5 or 13 characters. If the key is defined as hexadecimal, it must contain exactly 10 or 26 hexadecimal characters.
Example:
Does not validate anything.
Tests on the server side whether the value is a path pointing to a directory or a path pointing to a symlink of a directory.
Example:
Tests on the server side whether the value is a path pointing to a directory or a path pointing to a symlink of a directory.
Example:
Tests on the server side whether the value is a path pointing to a device or a path pointing to a symlink of a device.
Example:
Verify if the value is a valid UCI name.
Example:
Verify if the value is a valid number between min and max.
Example:
Verify if the value is a valid number above or equal to min.
Example:
Verify if the value is a valid number below or equal to max.
Example:
Verify if the value fits in length between min characters and max characters.
Example:
Verify if the value has at least min characters or more.
Example:
Verify if the value has at most max characters or less.
Example:
Verify if the value qualifies as a phone number containing digits from 0 to 9, star, or pound.
Example: