I have a form. There are two selectboxes which are cannot be 0: field1, field2. If I set POST method then it works fine. If GET - wrong.
Here my controllers' part:
$this->view->searchForm = new Default_Form_Parameters();
$data = $this->getRequest()->getParams();
if ($this->view->searchForm->isValid($data)) {
}
If I have following request then isValid returns false. That's ok.
http://site.ru/?field1=0&field2=0
If I have another request like
http://site.ru/?crash
then isValid returns true. That is wrong.
Any ideas whats the problem?
PS here one of fields with validator:
$required = new Zend_Validate_NotEmpty();
$required->setType ($required->getType() | Zend_Validate_NotEmpty::INTEGER | Zend_Validate_NotEmpty::ZERO);
$input = new Zend_Form_Element_Select('cat');
$input->setLabel('theme')
->addMultiOptions(array('0' => ' ----------- ') + $categories)
->addValidators (array ($required));