I'm getting validation errors on a select form element that I can't track
down at all.

Here's the form element created in form sub-class: 


      //softwarelist
      $software_source = $this->createElement('select','software_source');

      $software_source->setLabel('Add Software Title to List:')
      ->setIsArray(true);
      $software_target = $this->createElement('select','software_target');
      $software_target->setLabel('Suite Software')
      ->setIsArray(true)
     ->addValidator('NotEmpty',true)
     ->addValidator('Int')
     ->setRequired(true)
      ;

Note that there is no InArray check on the software target element.

In the controller, I do something like,

if ($this->_request->isPost()) {

   $form_data = $this->_request->getPost();

   if ($form->isValid($form_data)) {
   //process the form...
   } else {
   //handle errors
   }

When the form is submitted, the form never validates. If I do a
print_r($form->getErrors()) in the "//handle erorrs" logic above, I get the
following:

[software_target] => Array ( [0] => notInArray ) 

The software_target error array has an entry for each selected item.

How can the software_target element throw this error if it doesn't have the
validator attached to it? Pulling my hair out...


-- 
View this message in context: 
http://www.nabble.com/zend_form-mystery-validation-driving-me-nuts-tp19862848p19862848.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to