Issues

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

Issue Type: Sub-task Created: 2009-11-19T03:31:15.000+0000 Last Updated: 2010-04-16T12:53:50.000+0000 Status: Resolved Fix version(s): Reporter: seba kerckhof (seba) Assignee: Christian Albrecht (alab) Tags: - Zend_Form

Related issues: Attachments:

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:

<pre class="highlight">
        $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:

<pre class="highlight">
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

Posted by Christian Albrecht (alab) on 2010-03-25T13:24:00.000+0000

Will work on belongsTo when finished elementsBelongTo.

Posted by Christian Albrecht (alab) on 2010-04-16T12:53:50.000+0000

Applied patch and Unit Test to parent Issue ZF-9607

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts