public function init() { parent::init(); $this->setLabel($this->getName()); $validator = new Form_Validate_Date(); $validator->setMessages(array(Zend_Validate_Date::INVALID => 'validation_error_date_invalid', Zend_Validate_Date::INVALID_DATE => 'validation_error_date_invaliddate', Zend_Validate_Date::FALSEFORMAT => 'validation_error_date_falseformat')); $this->setValidators(array($validator)); $this->setAttrib('placeholder', $this->getTranslator()->translate('date_format')); $this->setAttrib('size', 12); $this->setAttrib('maxlength', 10); }
private function _validateDate() { if (!isset($this->session->language)) { return; } $lang = $this->session->language; $validators = array(); $validator = new Form_Validate_Date(); $validator->setLocale($lang); $messages = array(Zend_Validate_Date::INVALID => $this->translate('publish_validation_error_date_invalid'), Zend_Validate_Date::INVALID_DATE => $this->translate('publish_validation_error_date_invaliddate'), Zend_Validate_Date::FALSEFORMAT => $this->translate('publish_validation_error_date_falseformat')); $validator->setMessages($messages); $validators[] = $validator; return $validators; }