0

I have three fields: 1. Day 2. Month and 3. Year. How cand I build a zend Validator that checks for incorect formats like 30 february, 31 april and even leap years.

This is the form my validation is built in the controller:

$validators = array(
 "*" => array("allowEmpty" => true),
 "user_status" =>  array("presence"     => "required"),
 "fname"       =>  array("presence"     => "required"),
 "lname"       =>  array("presence"     => "required"),
 "tel_num"     =>  array(
                      'digits', 
                       array("StringLength", "minLength" => 8, "maxLength" => 15),
                               new Zend_Validate_Db_NoRecordExists('usersmeta','meta_value'),
              ),            
  "allowEmpty" => false
),
Tudor Ravoiu
  • 2,130
  • 8
  • 35
  • 56

1 Answers1

0

The Zend Framework already provides Zend_Validate_Date which accepts date strings in the format 'yyyy-MM-dd', eg 2013-11-13.

vascowhite
  • 18,120
  • 9
  • 61
  • 77