The
validValues property
(formerly the
range property) indicates a set of
values that are valid for user input. The property is used for numeric or
character fields. The format of the property is as follows:
validValues = arrayLiteral
- arrayLiteral
- An array literal of singular and two-value elements, as in the following
examples:
validValues = [ [1,3], 5, 12 ]
validValues = [ "a", ["bbb", "i"]]
Each singular element
contains a valid value. Each two-value element contains a range:
- For numbers, the leftmost value is the lowest that is valid,
the rightmost is the highest. In the previous example, the values 1, 2, and
3 are valid for a field of type INT.
- For character fields, user input is compared against the range of values,
for the number of characters for which a comparison is possible. For example,
the range ["a", "c"] includes (as valid) any input whose first character is
"a", "b", or "c". Although the string "cat" is greater than "c" in collating
sequence, "cat" is valid input.
The general rule is as follows: if the first
value in the range is called
lowValue and the second is called
highValue,
the user's input is valid if
any of these tests are fulfilled:
- User input is equal to lowValue or highValue
- User input is greater than lowValue and less than highValue
- The initial series of input characters matches the initial series of characters
in lowValue, for as long as a comparison is possible
- The initial series of input characters matches the initial series of characters
in highValue, for as long as a comparison is possible
Additional examples are as follows:
// valid values are 1, 2, 3, 5, 7, 9, and 11
validValues = [[1, 3], 5, 7, 11]
// valid values are the letters "a" and "z"
validValues = ["a", "z"]
// valid values are any string beginning with "a"
validValues = [["a", "a"]]
// valid values are any string
// beginning with a lowercase letter
validValues = [["a", "z"]]
If the user's input is outside the specified range, EGL runtime displays
a message, as described in relation to the field property validValuesMsgKey.