Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

isValid in zend framework form returns FALSE

I have zend framework controller. In init method i create a form and fill the drop-down box with

$form = new FORM_NAME();
$form->getElement('ZdGroup')->addMultiOptions($zendesk_groups);

then in action i check

$formData = $this->getRequest()->getParams();
    if ($form->isValid($formData)) {
        ...
}

but isValid() returns FALSE if I delete this line $form->getElement('ZdGroup')->addMultiOptions($zendesk_groups); it return TRUE.

I don't understand why, does anybody have an idea?

like image 944
Kirill Reva Avatar asked Apr 13 '12 18:04

Kirill Reva


1 Answers

To answer the question of 'why', have you dumped the form error messages?

$form->getMessages(); //error messages
$form->getErrors(); //error codes
$form->getErrorMessages(); //any custom error messages

That might at least give you a better idea of 'why'.

like image 156
Tim Lytle Avatar answered Dec 15 '22 00:12

Tim Lytle