Expanded Field Validation in BDF
The latest release of the Data Integration Toolset provides expanded field validation within the Business Data Form Adapter.
Below you will find the configuration for setting up field validation. In the configuration below, TestField is being compared to TestField2. In order to pass the validation rule, TestField must equal TestField2. If they are not equal, a validation message will appear and the form will not submit.
<Control type="TextBox">
<ControlName>TestField</ControlName>
<ControlSize>150</ControlSize>
<DefaultText>2</DefaultText>
<ValidationRules>
<Validation type="fieldcompare">
<Child>TestField2</Child>
<Value>equal</Value>
<ConvertValueTo>number</ConvertValueTo>
</Validation>
</ValidationRules>
</Control>
<Control type="TextBox">
<ControlName>TestField2</ControlName>
<ControlSize>150</ControlSize>
<DefaultText>1</DefaultText>
</Control>
In the <ValidationRules> node, you will find the <Validation> node which indicates that a fieldcompare rule is being established. You have a number of comparison options listed in the table below.
| Valid Comparison Value Options |
| greaterthan |
| greaterequal |
| lessthan |
| lessequal |
| equal |
| notequal |
The Child node indicates which field the current control is being compared to. And the Value node indicates what type of compare will occur.
The ConvertValueTo indicates how the fields should be treated when being compared. The table below lists the valid field conversion options.
| Valid ConvertValueTo Options |
| Number |
| Date |
| String |
This expanded validation capability has certainly added a lot of value for doing form validation using the Business Data Form Adapter. If more complex validation needs to take place, you can always write javascript to do other kinds of validation on fields. For an example on how to implement this technique, please check out this blog post that discusses Date Validation.
Rodney Fickas
Professional Services
Posted by Rodney Fickas on 6-Mar-09
