Because the required rule doesn??™t require any further
details, the null value comes next. However, if this were a minlength rule, the minimum
length would be specified here. The client value specifies that validation will occur on
the client side. If the browser lacks sufficient JavaScript capabilities, not to worry;
server-side validation is also always performed.
?– Note HTML_QuickForm also supports file uploading and rules for validating these files. However,
due to the extensive coverage devoted to file uploads in Chapter 15, with special attention given to the
HTTP_Upload PEAR package, this particular feature of HTML_QuickForm is not covered in this chapter.
Enforcing Filters and Rules
Because filters are nonintrusive constraints, meaning they execute without requiring
user notification, they simply happen when the form is processed. Rules, on the other
hand, won??™t be enforced without executing the validate() method. If validate()
executes okay, all of the rules were satisfied; otherwise, the appropriate error messages
are displayed.
minlength Value must equal or exceed
N characters
Integer value
nopunctuation Value cannot contain punctuation
nonzero Value cannot begin with zero
numeric Value must be a number
rangelength Value must be between the minimum
and maximum characters
array(min,max)
regex Value must correctly pass regular
expression
Regular expression
required Value required
Table 13-1.
Pages:
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437