开发者

how to check if the enddate is after the startdate in a zend form

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜