CHAPTER 8 Displaying and Validating Data
DataWindow Designer User’s Guide 255
About validation rules
When users enter data in a DataWindow object, you want to be sure the data is
valid before using it to update the database. Validation rules provide one way
to do this.
You usually define validation rules in the Database painter. To use a validation
rule, you associate it with a column in the Database painter or DataWindow
object painter.
Another technique
You can also perform data validation through code tables, which are
implemented through a column's edit style.
For more information, see “About edit styles” on page 238.
Understanding validation rules
Validation rules are criteria that a DataWindow object uses to validate data
entered into a column by users. They are DataWindow Designer specific and
therefore not enforced by the DBMS.
Validation rules assigned in the Database painter are used by default when you
place columns in a DataWindow object. You can override the default rules in
the DataWindow object painter.
A validation rule is an expression that evaluates to either
TRUE or FALSE. If
the expression evaluates to
TRUE for an entry into a column, DataWindow
Designer accepts the entry. If the expression evaluates to
FALSE, the entry is
not accepted and the ItemError event is triggered. By default, DataWindow
Designer displays a message box to the user. You can customize the message
displayed when a value is rejected.
You can also code the ItemError event to cause different processing to happen.
For more information, see the chapter on using DataWindow objects in the
Programmer’s Guide.