Form Properties: Validation

The Validation Properties are specific to Text Boxes and Dropdowns. The content of the data may be validated in these fields; in other words, it enables checking for acceptable values.

Field value is not validated: This is the default setting; it indicates that there will be no validation for the field.

Field value is in range: The field range is enabled if a Number or Percentage format is used. The From value is the lower part of the range, and the To value is the upper part of the range. These values will include the numbers specified in the From and To fields.

Run Custom Validation Script: Enter a Custom JavaScript function to invoke a custom Validation Script. To validate the field, the script must set the event’s return code to true; to invalidate the data, the script must set the event’s return code to false. The following is an example where the data for a Text Box must be a number that is less than -10,000, greater than 10,000, or in between -10 and 10.

 

var data = new Number(event.value);

if (-10 <= data && data <= 10)

event.rc = true;

elseif (data <= -10000)

event.rc = true;

elseif (data >= 10000)

event.rc = true;

else

event.rc = false;

 

if (!event.rc) {

var message = "the data must be:";

message += "less than -10000,";

message += "greater than 10000,";

message += "or between -10 and 10";

app.alert(message);

}