Form ValidationDataface allows you to add validation rules to fields using the fields.ini file
A common requirement for forms is to have some validation rules. Here are some example validation rules:
There is no end to the types of things that you will need to
validate. Dataface takes care of most of this for you with both
client-side (javascript) and server-side validation. All you have
to do is define some validation rules in the fields.ini file. Example 1: Make 'Username' a required field[Username] Placing the above inside the fields.ini file will cause the Username field to be a required field. Example 2: Username must be between 6 and 16 characters longFor this rule we will use a regular expression. [Username] Example 3: Email field must contain a valid email address[Email] Available validation rulesDataface uses the PEAR library HTML_Quickform for validation, so any
of the validators available in this package will be available in
Dataface. Some of the available validation rules include:
Default validation rulesThere are certain validation rules that are automatically applied to
fields of with certain characteristics. For example, any field
designated NOT NULL in the SQL table definition will automatically be a
'required' field. At the time of this writing, that is the only
'default' validation rule applied, but more may be added in the future
if their addition makes sense.
|