[]
        
(Showing Draft Content)

Input String Validation (PreValidation)

Input string validation is controlled by the PreValidation property. The PreValidation class allows you to specify validation rules either as wildcard pattern strings or regular expression strings. All rules (strings) are specified in the PatternString property. Multiple rules (sub-strings) are separated by the ItemSeparator ('|' by default).

The PreValidation property defines how the PatternString is interpreted.

Value Description
ExactList PatternString contains a list of possible values separated by ItemSeparator.
PreValidatingEvent The PreValidating event is being used in validation.
Wildcards PatternString contains a list of wildcard patterns separated by the ItemSeparator. The following characters are reserved in a pattern: ? (any single character), # (any single digit), * (zero or more characters), \ (escape). You can also define your own custom pattern characters using the PreValidation property.
RegexPattern PatternString contains a regular expression.

Using the PreValidatingEvent option, you can perform input string validation in code, in the PreValidating event. For more information, see the event description.

If you use regular expressions, the RegexPattern option, there is also a RegexOptions property that is sometimes needed to set flags affecting regular expression functionality.

type=note

Note: Input string validation (PreValidation) is not used in DateTimeInput and NumericInput modes. When DateTimeInput or NumericInput modes are active is Typed Value Validation (PostValidation) is performed.

Examples

The following examples describe how the Validation and PatternString properties are interpreted:

  • Validation property set to ExactList, PatternString property set to red|green|blue: Input string must be one of the three permitted values, red, green or blue, possibly ignoring the case, if CaseSensitive is set to False.
  • Validation property set to Wildcards, PatternString property set to (412)*: Input string must start with (412), possibly ignoring the case, if CaseSensitive is set to False.
  • Validation property set to RegexPattern, PatternString set to [0-9]*: Input string contains one or more digits.

See Also

Typed Value Validation (PostValidation)