Modifying field validators
You configure field validation in Guidewire Studio by editing fieldvalidtors.xml files in various locations in the fieldvalidators folder. In Studio, navigate in the Project tools window to .
- You define global field validators once in the fieldvalidtors.xml file located in the root of the fieldvalidators folder.
- You define national field validators in fieldvalidtors.xml files located in country-specific packages in the fieldvalidators folder.
You can, for example:
- Create a new field validator. For
example:
<!-- Create a new validator --> <ValidatorDef name="ExampleValidator" value="[A-z]{1,5}" description="Validator.Example" input-mask="#####" /> - Modify attributes of an existing validator. For
example:
<!-- Modify a validator definition. Adding a ValidatorDef element with the same name as one defined in the base fieldvaldators.xml file replaces the base validator. --> <ValidatorDef name="PolicyNumber" value="[0-9]{3}-[0-9]{5}" description="Validator.PolicyNumber" input-mask="###-#####" /> - Define field validators for a specific country.
Using <column-override> to modify field validation
You use the <column-override>
element in an extension file to override attributes on a field validator
or to add a field validator to a field that does not contain one.
Adding a field validator to a field
About this task
To add a validator to an application field
that currently does not have one, use a <column-override> element
in the specific entity extension file. Use the following syntax:
<extension entityName="SomeEntity">
<column-override name="SomeColumn">
<columnParam name="validator" value="SomeCustomValidator"/>
</column-override>
</extension>
Suppose that you want to create a validator for a Date of Birth field (Person.DateOfBirth). To create this
validator, you need to perform the following steps in Studio.
Procedure
-
Create a Person.etx file if one does not exist and add the following to it.
<extension entityName="Person"> <column-override name="DateOfBirth"> <columnParam name="validator" value="DateOfBirth"/> </column-override> </extension> -
Add a validation definition for the
DateOfBirthvalidator to fieldvalidators.xml.For example:<ValidatorDef description="Validator.DateOfBirth" ... name="DateOfBirth" .../>In this case, you can potentially create differentDateOfBirthvalidators in different country-specificfieldvalidatorsfiles.
Changing the length of a text field
About this task
You can use the <column-override> element to change the size (length) of the text that a user can enter into a text box or field. Guidewire makes a distinction between the size attribute and the logicalSize attribute.
- The
sizeattribute is the length of the database column (if aVARCHARcolumn). - The
logicalSizeattribute is the maximum length of the field that the application permits. It must not be greater thansizeattribute (if applicable).
In this case, you set the logicalSize parameter, not a size parameter. This parameter does not change the column length of the field in the database. You use the logicalSize parameter simply to set the field length in the PolicyCenter interface. For example:
<column-override name="EmailAddressHome">
<columnParam name="logicalSize" value="42"/>
</column-override>
The use of the logicalSize parameter does not affect the actual length of the column in the database. It merely affects how many characters a user can enter into a text field.
