Welcome to the Cookbook

loading...

4.1.4.23 postal

Postal is used to validate ZIP codes from the U.S. (us), Canada (ca), U.K (uk), Italy (it), Germany (de) and Belgium (be). For other ZIP code formats, you may provide a regular expression as the second parameter.

var $validate = array(
    'zipcode' => array(
        'rule' => array('postal', null, 'us')
    )
);
  1. var $validate = array(
  2. 'zipcode' => array(
  3. 'rule' => array('postal', null, 'us')
  4. )
  5. );