Custom Control Validator - Sample Code

Create a Custom Validator for control validation

This sample plugin demonstrates custom validation for an individual control. For an example of how to validate an entire screen, refer to the Create a Custom Validator for screen validation example.

About the sample

In this example, we validate the age details entered by the user to ensure it is a number greater than 0 and less than 130.

 

The sample code demonstrates:

 

The sample code needs the following to run:

To setup this scenario

  1. Copy the rulebase .zip file (CustomValidatorExample.zip) from examples\rulebases\compiled to the rulebase folder in Web Determinations (for example, <webroot>\WEB-INF\classes\rulebases)
  2. Copy and install the CustomControlValidator.jar file (located in examples\interview-engine\custom-control-validator) into Web Determinations; for more information, refer to Create a Plugin. If you wish to modify the CustomControlValidator code, do the following:
    1. Copy the code for the CustomControlValidator plugin
    2. Modify the validation code in the handleEvent method
    3. Compile and JAR or DLL the CustomControlValidator
  3. Run a Web Determinations Interview

Source

To view the source code for the CustomScreenValidator sample, refer to examples\interview-engine\custom-control-validator in the Java or .NET runtime zip file.