From wiki.ginstr.com
Jump to: navigation, search

NumberValidator

Description
NumberValidator performs a number value 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

minValue Defines minimum value of number in field

Can be

  • hardcoded
  • @string
maxValue Defines maximum value of number in field

Can be

  • hardcoded
  • @string
message* Defines default message to be displayed when validation fails

Can be

  • hardcoded
  • @string

Reserved tokens

In @string resources that are used for validator messages it's possible to use special tokens (reserved words). Token will be replaced by actual value during runtime of ginstr app.

For NumberValidator
  • ${minValue} - will be replaced by the content of the minValue validator attribute
  • ${maxValue} - will be replaced by the content of the maxValue validator attribute

Validator signatures

Number validator

[name:NumberValidator],[message=validatorMessage], [minValue=value], [maxValue=value]]

Example

message=@string/validationError - validation error message
minValue=2 - min value
maxValue=8 - max value
NUMBERErrMsg=@string/numberError - number error message
[name:NumberValidator], [message=@string/validationError], [minValue=2], [maxValue=8]