TextValidator
- Description
TextValidator
performs a text content validation check.- Can be used on
GnEditText
widgets only. - It contains subvalidators from which each performs a validation if present.
- At least one subvalidation attribute is required in validator definition.
Attributes
Note: An attribute marked with asterisk (*) is obligatory
Attribute | Description |
---|---|
message *
|
Defines default message to be displayed when validation fails
Can be
|
minLength
|
Defines minimum length of text in field
Can be
|
minLengthErrMsg
|
Defines error message for minLength validation fail
Can be
|
maxLength
|
Defines maximum length of text in field
Can be
|
maxLengthErrMsg
|
Defines error message for maxLength validation fail
Can be
|
inputType
|
Defines special pattern for text in field
Must be one of input types Can be
|
NUMBERErrMsg
|
Defines error message for number validation fail
Can be
|
TEXTErrMsg
|
Defines error message for text validation fail
Can be
|
TEXTNUMBERErrMsg
|
Defines error message for text and number field validation fail
Can be
|
EMAILErrMsg
|
Defines error message for email field validation fail
Can be
|
REGEXErrMsg
|
Defines error message for regular expression validation fail
Can be
|
inputTypeErrMsg
|
Defines error message for rest of text validation fails
Can be
|
pattern
|
Special attribute that only needs to be present when inputType=REGEX (Regular expression)
Can be
|
Validator signatures
Compare values
[name:ComparatorValidator], [message=validatorMessage], [minLength=NUMBER], [minLengthErrMsg=minLengthErrorMessage], [maxLength=NUMBER],[maxLengthErrMsg=maxLengthErrorMessage], [inputType=INPUTTYPE],[NUMBERErrMsg=numberErrorMessage], [TEXTErrMsg=textErrorMessage], [TEXTNUMBERErrMsg=textNumberErrorMessage],[EMAILErrMsg=emailErrorMessage], [REGEXErrMsg=regexErrorMessage], [inputTypeErrMsg=inputTypeErrorMessage], [pattern=pattern]]
Example
message=@string/validationError
- validation error messageminLength=2
- min lengthmaxLength=8
- max lengthinputType=NUMBER
- input typeNUMBERErrMsg=@string/numberError
- number error messagemaxLengthErrMsg=@string/lengthError
- length error message
- ⤷
[name:TextValidator], [message=@string/validationError], [minLength=2], [maxLength=8], [inputType=NUMBER], [NUMBERErrMsg=@string/numberError], [maxLengthErrMsg=@string/lengthError]
- ⤷
Input types
Defines special pattern for text in field. If text satisfies pattern it passes validation.
Value | Description |
---|---|
NUMBER
|
Allows only numbers in the text field |
TEXT
|
Allows only text in the text field |
TEXTNUMBER
|
Allows text and numbers only in text field |
EMAIL
|
Allows only email addresses in text field |
REGEX
|
Allows designer defined pattern in text field |
PHONE
|
Allows only phone number in text field |