(→Input types) |
m (formatting) |
||
Line 5: | Line 5: | ||
;Description | ;Description | ||
: <code>[[TextValidator]]</code> performs a text content validation check. | : <code>[[TextValidator]]</code> performs a text content validation check. | ||
− | : Can be used on [[GnEditText]] widgets only. | + | : Can be used on <code>[[GnEditText]]</code> widgets only. |
: It contains subvalidators from which each performs a validation if present. | : It contains subvalidators from which each performs a validation if present. | ||
: At least one subvalidation attribute is required in validator definition. | : At least one subvalidation attribute is required in validator definition. | ||
Line 17: | Line 17: | ||
! scope="col" | Description | ! scope="col" | Description | ||
|- | |- | ||
− | | title="Attribute" | message<span style="color:red">*</span> | + | | title="Attribute" | <code>message</code><span style="color:red">*</span> |
| title="Description" | Defines default message to be displayed when validation fails | | title="Description" | Defines default message to be displayed when validation fails | ||
Line 24: | Line 24: | ||
* <code>@string</code> | * <code>@string</code> | ||
|- | |- | ||
− | | title="Attribute" | minLength | + | | title="Attribute" | <code>minLength</code> |
| title="Description" | Defines minimum length of text in field | | title="Description" | Defines minimum length of text in field | ||
Line 31: | Line 31: | ||
* <code>@string</code> | * <code>@string</code> | ||
|- | |- | ||
− | | title="Attribute" | minLengthErrMsg | + | | title="Attribute" | <code>minLengthErrMsg</code> |
| title="Description" | Defines error message for <code>minLength</code> validation fail | | title="Description" | Defines error message for <code>minLength</code> validation fail | ||
Line 38: | Line 38: | ||
* <code>@string</code> | * <code>@string</code> | ||
|- | |- | ||
− | | title="Attribute" | maxLength | + | | title="Attribute" | <code>maxLength</code> |
| title="Description" | Defines maximum length of text in field | | title="Description" | Defines maximum length of text in field | ||
Line 45: | Line 45: | ||
* <code>@string</code> | * <code>@string</code> | ||
|- | |- | ||
− | | title="Attribute" | maxLengthErrMsg | + | | title="Attribute" | <code>maxLengthErrMsg</code> |
| title="Description" | Defines error message for <code>maxLength</code> validation fail | | title="Description" | Defines error message for <code>maxLength</code> validation fail | ||
Line 52: | Line 52: | ||
* <code>@string</code> | * <code>@string</code> | ||
|- | |- | ||
− | | title="Attribute" | inputType | + | | title="Attribute" | <code>inputType</code> |
| title="Description" | Defines special pattern for text in field | | title="Description" | Defines special pattern for text in field | ||
Must be one of [[#Input_types|input types]] | Must be one of [[#Input_types|input types]] | ||
Line 60: | Line 60: | ||
* <code>@string</code> | * <code>@string</code> | ||
|- | |- | ||
− | | title="Attribute" | NUMBERErrMsg | + | | title="Attribute" | <code>NUMBERErrMsg</code> |
| title="Description" | Defines error message for number validation fail | | title="Description" | Defines error message for number validation fail | ||
Line 67: | Line 67: | ||
* <code>@string</code> | * <code>@string</code> | ||
|- | |- | ||
− | | title="Attribute" | TEXTErrMsg | + | | title="Attribute" | <code>TEXTErrMsg</code> |
| title="Description" | Defines error message for text validation fail | | title="Description" | Defines error message for text validation fail | ||
Line 74: | Line 74: | ||
* <code>@string</code> | * <code>@string</code> | ||
|- | |- | ||
− | | title="Attribute" | TEXTNUMBERErrMsg | + | | title="Attribute" | <code>TEXTNUMBERErrMsg</code> |
| title="Description" | Defines error message for text and number field validation fail | | title="Description" | Defines error message for text and number field validation fail | ||
Line 81: | Line 81: | ||
* <code>@string</code> | * <code>@string</code> | ||
|- | |- | ||
− | | title="Attribute" | EMAILErrMsg | + | | title="Attribute" | <code>EMAILErrMsg</code> |
| title="Description" | Defines error message for email field validation fail | | title="Description" | Defines error message for email field validation fail | ||
Line 88: | Line 88: | ||
* <code>@string</code> | * <code>@string</code> | ||
|- | |- | ||
− | | title="Attribute" | REGEXErrMsg | + | | title="Attribute" | <code>REGEXErrMsg</code> |
| title="Description" | Defines error message for regular expression validation fail | | title="Description" | Defines error message for regular expression validation fail | ||
Line 95: | Line 95: | ||
* <code>@string</code> | * <code>@string</code> | ||
|- | |- | ||
− | | title="Attribute" | inputTypeErrMsg | + | | title="Attribute" | <code>inputTypeErrMsg</code> |
| title="Description" | Defines error message for rest of text validation fails | | title="Description" | Defines error message for rest of text validation fails | ||
Line 102: | Line 102: | ||
* <code>@string</code> | * <code>@string</code> | ||
|- | |- | ||
− | | title="Attribute" | pattern | + | | title="Attribute" | <code>pattern</code> |
| title="Description" | Special attribute that only needs to be present when <code>inputType=REGEX</code> (Regular expression) | | title="Description" | Special attribute that only needs to be present when <code>inputType=REGEX</code> (Regular expression) | ||
Line 114: | Line 114: | ||
===Compare values=== | ===Compare values=== | ||
− | ;<code>[name:ComparatorValidator],[message=[[strings.xml|validatorMessage]]],[minLength=NUMBER],[minLengthErrMsg=[[strings.xml|minLengthErrorMessage]]],[maxLength=NUMBER],[maxLengthErrMsg=[[strings.xml|maxLengthErrorMessage]]],[inputType=INPUTTYPE],[NUMBERErrMsg=[[strings.xml|numberErrorMessage]]],[TEXTErrMsg=[[strings.xml|textErrorMessage]]],[TEXTNUMBERErrMsg=[[strings.xml|textNumberErrorMessage]]],[EMAILErrMsg=[[strings.xml|emailErrorMessage]]],[REGEXErrMsg=[[strings.xml|regexErrorMessage]]],[inputTypeErrMsg=[[strings.xml|inputTypeErrorMessage]]],[pattern=[[strings.xml|pattern]]]]</code> | + | :;<code>[name:ComparatorValidator], [message=[[strings.xml|validatorMessage]]], [minLength=NUMBER], [minLengthErrMsg=[[strings.xml|minLengthErrorMessage]]], [maxLength=NUMBER],[maxLengthErrMsg=[[strings.xml|maxLengthErrorMessage]]], [inputType=INPUTTYPE],[NUMBERErrMsg=[[strings.xml|numberErrorMessage]]], [TEXTErrMsg=[[strings.xml|textErrorMessage]]], [TEXTNUMBERErrMsg=[[strings.xml|textNumberErrorMessage]]],[EMAILErrMsg=[[strings.xml|emailErrorMessage]]], [REGEXErrMsg=[[strings.xml|regexErrorMessage]]], [inputTypeErrMsg=[[strings.xml|inputTypeErrorMessage]]], [pattern=[[strings.xml|pattern]]]]</code> |
====Example==== | ====Example==== | ||
− | <code>message=@string/validationError</code> - validation error message<br> | + | :<code>message=@string/validationError</code> - validation error message<br> |
− | <code>minLength=2</code> - min length<br> | + | :<code>minLength=2</code> - min length<br> |
− | <code>maxLength=8</code> - max length<br> | + | :<code>maxLength=8</code> - max length<br> |
− | <code>inputType=NUMBER</code> - input type<br> | + | :<code>inputType=NUMBER</code> - input type<br> |
− | <code>NUMBERErrMsg=@string/numberError</code> - number error message<br> | + | :<code>NUMBERErrMsg=@string/numberError</code> - number error message<br> |
− | <code>maxLengthErrMsg=@string/lengthError</code> - length error message | + | :<code>maxLengthErrMsg=@string/lengthError</code> - length error message<br> |
− | <code>[name:TextValidator],[message=@string/validationError],[minLength=2],[maxLength=8],[inputType=NUMBER],[NUMBERErrMsg=@string/numberError],[maxLengthErrMsg=@string/lengthError]</code> | + | :; ⤷ <code>[name:TextValidator], [message=@string/validationError], [minLength=2], [maxLength=8], [inputType=NUMBER], [NUMBERErrMsg=@string/numberError], [maxLengthErrMsg=@string/lengthError]</code> |
==Input types== | ==Input types== | ||
Line 133: | Line 133: | ||
! scope="col" | Description | ! scope="col" | Description | ||
|- | |- | ||
− | | title="Value" | NUMBER | + | | title="Value" | <code>NUMBER</code> |
| title="Description" | Allows only numbers in the text field | | title="Description" | Allows only numbers in the text field | ||
|- | |- | ||
− | | title="Value" | TEXT | + | | title="Value" | <code>TEXT</code> |
| title="Description" | Allows only text in the text field | | title="Description" | Allows only text in the text field | ||
|- | |- | ||
− | | title="Value" | TEXTNUMBER | + | | title="Value" | <code>TEXTNUMBER</code> |
| title="Description" | Allows text and numbers only in text field | | title="Description" | Allows text and numbers only in text field | ||
|- | |- | ||
− | | title="Value" | EMAIL | + | | title="Value" | <code>EMAIL</code> |
| title="Description" | Allows only email addresses in text field | | title="Description" | Allows only email addresses in text field | ||
|- | |- | ||
− | | title="Value" | REGEX | + | | title="Value" | <code>REGEX</code> |
| title="Description" | Allows designer defined pattern in text field | | title="Description" | Allows designer defined pattern in text field | ||
|- | |- | ||
− | | title="Value" | PHONE | + | | title="Value" | <code>PHONE</code> |
| title="Description" | Allows only phone number in text field | | title="Description" | Allows only phone number in text field | ||
|} | |} |
Revision as of 21:03, 12 July 2017
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 |