From wiki.ginstr.com
Revision as of 21:03, 12 July 2017 by Mark (talk | contribs) (formatting)
Jump to: navigation, search

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

  • hardcoded
  • @string
minLength Defines minimum length of text in field

Can be

  • hardcoded
  • @string
minLengthErrMsg Defines error message for minLength validation fail

Can be

  • hardcoded
  • @string
maxLength Defines maximum length of text in field

Can be

  • hardcoded
  • @string
maxLengthErrMsg Defines error message for maxLength validation fail

Can be

  • hardcoded
  • @string
inputType Defines special pattern for text in field

Must be one of input types

Can be

  • hardcoded
  • @string
NUMBERErrMsg Defines error message for number validation fail

Can be

  • hardcoded
  • @string
TEXTErrMsg Defines error message for text validation fail

Can be

  • hardcoded
  • @string
TEXTNUMBERErrMsg Defines error message for text and number field validation fail

Can be

  • hardcoded
  • @string
EMAILErrMsg Defines error message for email field validation fail

Can be

  • hardcoded
  • @string
REGEXErrMsg Defines error message for regular expression validation fail

Can be

  • hardcoded
  • @string
inputTypeErrMsg Defines error message for rest of text validation fails

Can be

  • hardcoded
  • @string
pattern Special attribute that only needs to be present when inputType=REGEX (Regular expression)

Can be

  • hardcoded
  • @string

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 message
minLength=2 - min length
maxLength=8 - max length
inputType=NUMBER - input type
NUMBERErrMsg=@string/numberError - number error message
maxLengthErrMsg=@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