We have developed our ongoing application in Zend Framework 1.6.0 and later upgrade it to 1.6.2. After 2 months, Zend released their version 1.7. With no hesitation, I upgraded our application.
However, the date validation didn’t work anymore.
Here is my class code:
<?php require_once APPLICATION_PATH . '/forms/BaseForm.php'; class Form_Iraisyo01 extends BaseForm { protected $_maxSubforms = 20; protected $_subformTabStart = 35; /** * Initilizes the Form with values and validation rules * It also sets the default values for select elements * * @return void */ public function init() { $lastTabIndex = 0; $this->baseInit(); $this->setMethod('post'); //add Import_Export radio buttons $impExpOptions = array( '1' => '輸出', '2' => '輸入', '3' => 'その他'); $this->addElement('radio', 'Imp_Exp', array( 'decorators' => array( array('ViewHelper') ), 'separator' => '', 'required' => true, 'value' => array('1'), 'multiOptions' => $impExpOptions )); unset($importOptions); //add request date $this->addElement('text', 'Request_Date', array( 'decorators' => array('ViewHelper'), 'required' => true, 'tabindex' => '4', 'class' => 'date-pick', 'maxlength' => '10', 'filters' => array('StringTrim') )); $this->getElement('Request_Date')->addValidator(new Zend_Validate_Date('Y/M/d')); //the rest of the codes
My format was: “yyyy/mm/dd” and the format in Zend is “Y/M/d”. I don’t know what’s going on so I tried to investigate. I’ve found out that there was a problem with Zend_Locale and Zend_Date. As if it does not apply my specified format, rather implement the default format based on “MMM d, yyy”.
As of now, I’m trying to resolve this issue since it would delay our development.