ZF-8335: Bug with required select field in array notation

Description

Hello,

I believe I found a bug, it could be me doing something wrong, but I can't find much information about it:

I have a form with select elements that use the 'belongsto' property and are required. It keeps telling me the selected values are empty, while they're not.

Complete description:

I have a form that extends Zend_Form, in the init I add some elements to the form. I added two select fields, that I want in array notation:


        $this->addElement('userselect','instructor',array(
            'label' =>  'Instructor:',
            'required' => true,
            'belongsTo' => 'obligated'));
        
        $this->addElement('userselect','pilot',array(
            'label' =>'Pilot:',
            'required' => true,
            'belongsTo' => 'obligated'));
        
        $this->addDisplayGroup(array('instructor','pilot'), 'reservation',array('order'=>25));

(userselect is a custom element, it's just a subclass of Zend_Form_Element_Select that adds all registered users)

This renders correctly as:


Instructor:
 
Testuser 1Testuser 2 
Pilot: 
 
Testuser 1Testuser 2

Now, if I want to submit the form, it keeps telling me: {quote}Value is required and can't be empty{quote} on both elements, while this obviously isn't the case...

Comments

Will work on belongsTo when finished elementsBelongTo.

Applied patch and Unit Test to parent Issue ZF-9607