Gosu field validation

An advanced kind of field validator defines a Gosu class that handles field validation programmatically. You can develop Gosu classes that act as field validators. PolicyCenter provides a class framework for developing Gosu-based field validators, located in the gw.api.validation package. Gosu-based field validators must extend the abstract FieldValidatorBase class.

Enabling national field validation for phone data

PolicyCenter uses the Gosu class gw.api.validation.PhoneValidator as the default mechanism to validate phone number correctness.

To enable the new PhoneValidator validation functionality, you configure fieldvalidators.xml with the fully qualified name of the Gosu class. For example:

<ValidatorDef description="Validator.Phone"
              name="LocalizedPhoneValidator"
              validation-type="gosu"
              value="gw.api.validation.PhoneValidator"/>

As shown in the previous example, you must set the validation type to gosu.

The validator does not trigger validation unless the associated phone country is set. This trigger functionality provides backwards compatibility with old data.

See also