addValidator('Date', false, ['format' => 'Y-m-d']); // $this->getValidator('Date')->setMessage('Date is in wrong format', Zend_Validate_Date::FALSEFORMAT); } public function getFormat() { return $this->_format; } public function setFormat($format) { $this->_format = (string) $format; return $this; } public function getYearRange() { return $this->_yearRange; } public function setYearRange($yearRange) { $this->_yearRange = (string) $yearRange; return $this; } public function getTooltipErrorStatus() { return $this->_tooltipErrorStatus; } public function setTooltipErrorStatus($status) { $this->_tooltipErrorStatus = $status; return $this; } public function loadDefaultDecorators() { if ($this->loadDefaultDecoratorsIsDisabled()) { return; } $decorators = $this->getDecorators(); if (empty($decorators)) { $this->addDecorator('JQuery_Datepicker') ->addDecorator('Errors') ->addDecorator('Description', array('tag' => 'p', 'class' => 'description')) ->addDecorator('HtmlTag', array('tag' => 'dd', 'id' => $this->getName() . '-element')) ->addDecorator('Label', array('tag' => 'dt')); } } public function render(Zend_View_Interface $view = null) { $this->_initLabel(); return parent::render($view); } protected function _initLabel() { /** @var Qs_Form_Decorator_JQuery_Datepicker $datePicker */ if (($datePicker = $this->getDecorator('JQuery_Datepicker')) && ($label = $this->getDecorator('Label'))) { $label->setOption('id', $datePicker->getDisplayId()); } return $this; } public function setValue($value) { return parent::setValue(empty($value) ? null : $value); } }