Validating Commonly Used Primitive Types

Primitive types can be validated by using pattern restrictions in a business object model and associated forms.

Sample Project

To view the sample for this task, import the advanced sample projects as described in Importing the Forms Advanced Samples. The sample forms and business object model for the task described in this section are contained in the forms.samples.bom sample project.

The form for this task (CapturePersonalDetails.form) is at:

   forms.samples.bom/Forms/BOMHowTo/BOMHowToProcess/
      CapturePersonalDetails/

The business object model (FormsSamplesBOM.bom) is at:

   forms.samples.bom/Business Objects/

Procedure

  1. Double-click the form and business object model filenames (as well as those of other project resources) in the Project Explorer to open them in the editor.
  2. Examine their contents and use them as models for your own projects.

Result

Result and Explanation

The business object model in the forms.sample.bom project models a PatternConstraints class, which makes use of the primitive types E-Mail Address, Post Code, ZIP Code, Social Security Number, Social Insurance Number, National Insurance Number, NA Telephone Number, and UK Telephone Number. Each of these primitive Text extension types has a pattern restriction that is automatically used to perform client-side validation of form entries. See the additional descriptions under Properties > <bom-primitive-type > > Description:

The Capture Personal Details form shows a Person, his or her personal details and preferences. Observe how the patterns modelled in the business object model are applied to user-specified form data.