I have a zend form with a start- and an endate.
$form = new Zend_Form();
$form->setName($this->formName)
->setMethod('post');
$feStartdate = new Zend_Form_Element_Text('startdate');
$feEnddate = new Zend_Form_Element_Text('enddate');
$form->addElement开发者_StackOverflow中文版($feStartDate)
->addElement($feEndDate)
->addElement('submit', 'submit', array('label' => 'Save'));
I assume I must write a custom validator for to check this. How would this custom validator look like and how can I call it? I assume something like
$feEnddate->addValidator('dateComesAfter', $feStartDate)
Yep, custom validator, combined with Zend_Date::isLater() would be the way to go.
精彩评论