To create a validator from a supplied validator type, follow these steps.
1. Create a textField or passwordField component and assign it an ID by editing its properties.
2. Right click in a UI file and select Data > Create Data Validator.
The Create Data Validator wizard appears.
3. Complete the Create Data Validator wizard similar to the following:
|
|
Type: Click on the type of validator to create from the list of validators displayed on the left. The appropriate attributes for the selected type of validator appear on the right. Complete the following fields for all types of supplied validators: ID: Specifies a unique ID for this instance of this type of validator. Value: Specifies the ID of a textField or passwordField in the UI file and the text attribute of that field to validate. Trim: Specifies whether Nexaweb removes white space from the beginning and end of the value specified as the value attribute before validation occurs. False - does not trim white space (default). True - trims white space. onSuccess: Specifies an MCO or Macro event to run - for example, to display a success message - upon successful validation. Press Ctrl+space bar for the syntax for specifying an existing event handler. Or click Advanced to define a new event handler. See Connecting Business Logic to the User Interface for more information on creating an event handler. onFailure: Specifies an MCO or Macro event to run - for example, to display a failed message if input does not meet validation requirements. Press Ctrl+space bar for the syntax for specifying an existing event handler. Or click Advanced to define a new event handler. See Connecting Business Logic to the User Interface for more information on creating an event handler. Complete the additional validator type specific attributes as described in the following table. |
|
Validator Type |
Additional Attributes |
Description |
|
currencyValidator |
locale |
Specifies the locale to use in currency formatting. Specify locale value in language-code_country-code format. |
|
|
prefix |
Specifies a prefix that must appear for any input values. For example, $ |
|
dataValidator |
format |
A valid java.text.SimpleDate format style to define acceptable date format. |
|
|
locale |
Specifies the locale to use in date formatting. Specify locale value in language-code_country-code format. |
|
rangeValidator |
format |
Use for ranges of floating point numbers to specify the precision of real numbers. Format must conform to the java.text.DecimalFormat format styles. If you do not specify a format for floating point numbers, validation might result in unexpected behavior. |
|
|
locale |
Specifies the locale to use in number formatting. Specify locale value in language-code_country-code format. |
|
|
maximum |
Maximum integer or decimal number the field can contain. |
|
|
minimum |
Minimum integer or decimal number the field can contain. |
|
stringLengthValidator |
maximum |
Maximum number of characters a field can contain. |
|
|
minimum |
Minimum number of characters a field can contain. |
|
Validator |
class |
References the validator subclass to use for this custom validator. |
Click Next.
A validator summary dialog appears similar to the following.
4. Verify the validator syntax.
- To change the validator, click Back.
- To bind the validator to a component, click Next.
The Bind validator with event attribute dialog appears similar to the following:
5. Select the component and component attribute to invoke the validator.
To review your selection in a summary dialog, click Next.
To add the validator, click Finish.
The validator appears in the appropriate validator type folder in the Validator view.