I have this form in Zend where the user should set up start & end date of something. I'm trying to invalidate the form / field if the end date is behind start date but it's not working. I overwritten the isValid() method and it worked but right now something else it's not working just because the isValid() method is overwritten.
how am i doing things:
$req = $this->getRequest();
$form->setAction($req->getRequestUri());
if($req->isPost() && $form->isValid($req->getPost())) {
$startTime = strtotime(date($form->getValue('live_start')));
$endTime = strtotime(date($form->getValue('live_end')));
if($startTime > $endTime){
$form->live_end->addError("End time shouldn't be earlier than start time !!!");
}
If I use die; inside the if() it will die. So it's guaranteed that that if it's working. I used all kind of methods but it's not working.
Anyone have some ideas why it doesn't?