Validation and Error Messages

 

Automatic Validation

Profound UI automatically handles validation and prevents submissions to RPG if validation is unsuccessful. Fields which are given a field data type and formatting automatically detect if the value entered is valid and can generate a tool tip error if they are not correct.

   

Validation Properties

Error message location - This determines where the tool tip error message will be displayed in conjunction with the field's location. This can be displayed above or below the field as well as left or right of the field. You can also choose to display no tool tip at all and have the message display as an on screen alert.

Mandatory entry - This property required the user to enter at least one valid character into the field. (A blank is considered a valid character.)

Mandatory fill - This requires a field to have all available characters filled.

Required - When this property is set to 'true' the field cannot be empty.

Valid values - Allows you to set a comma separated list of acceptable values a user can enter.

Comparison operator - The values of this property is used to compare the value entered in the input field with the comparison value. This property is based off of the DDS keyword COMP.

Comparison value - This is the value you wish to compare with the comparison operator. This property is based off of the DDS keyword COMP.

Range low - This sets a minimum value for range checking. Should be greater than or equal to the set value.

Range high - This sets a maximum value for range checking. Should be less than or equal to the set value.

Validate name - This property is used to validate a simple name. Using this property requires the first character to be $, #, @, or A through Z. Any remaining characters must be alphanumeric ($, #, @, A through Z, 0 through 9 or underscore ( _ ), and cannot contain embedded blanks.

Allow blanks - When Allow Blanks is set to 'true' a blank entry will validate successfully.

Set as modified - This marks the input field as a modified field when it's first displayed. This allows Profound UI to post server fields that have been modified in the browser. This property is typically used when converting a green screen application to enable accurate behavior.

Error messages

This property allows you to set a custom error messages for the input field. You can bind indicators to select which message to display once your validation condition has been met. The error message is displayed as a tooltip or an onscreen alert (see the error message location property). Error messages can be set as a static text message, loaded from an RPG field by using field binding, or even loading the message from a message file on your server.

When using error messages you will use the following properties:

Message Text - This can be a static text message or can also be bound to an RPG field.

Message Id, Message File, Library, Replacement Data - These options apply for when a message file is used. Here you can set the message id, file, library, and replacement data for the error message you wish to display. The replacement data field is a data structure that contains all the replacement values. The length and format of the field depends on the message description's substitution variables. For example, for a message description with 2 values *CHAR 10 and *DEC 7 2, the replacement data should be bound to a 14 byte field. The field could be defined using a data structure like this in the RPG program:

dcl-ds rplData qualified; val1 char(10); val2 packed(7 : 2); end-ds;

 

Error Condition - You can bind this option to an indicator or indicator expression.  If the bound indicator or expression evaluates to true, the error will be displayed, if it evaluates to false, the error will not be displayed.

Error Response - You can bind this option to an indicator to be turned off in response to this error.  Typically, this would be bound to the same field as the error condition when you want the indicator to be turned off after the error is displayed.

Enhanced mode - When this is checked, it allows error messages to display without ERRMSG/ERRMSGID-type restrictions. This means errors will display regardless of whether a format is already on the screen, and any output data is also sent. (This is the recommended mode.)

  

Bypassing Validation

There may be times when you want to bypass validation such as for cancel or exit buttons. You can bypass this client side validation by using the bypass validation property. Setting this property, you can allow exit or cancel buttons to not trigger validation and clear the data entered. This property also has additional settings to allow any data entered to bypass validation and submit to the RPG application if desired.

When bypass validation is set to 'true', all validation is bypassed and data from the screen is not sent to the application. This is similar in behavior to a Command Attention key in green screen. The DDS conversion will setup function key buttons/links this way when converting from Command Attention keys.

If the property is set to 'send data' then validation from validation properties is bypassed and data from the screen is still sent to the program. Since data is still being sent to the program, the built in data type validation (i.e. for numbers and dates) still runs to ensure data integrity is maintained.