ZF-9974: Zend_Form_Element->belongsTo not usable with same named multiple elements

Issue Type: Improvement Created: 2010-06-10T02:07:40.000+0000 Last Updated: 2010-06-10T03:06:06.000+0000 Status: Postponed Fix version(s): - Next Major Release ()

Reporter: Saman Darougheh (excuvator) Assignee: Christian Albrecht (alab) Tags: - Zend_Form

Related issues: Attachments:


Lets say i want to create two arrays inside one form, using belongsTo: if i want to use they same keys for both arrays, i have to name those elements the same. Unfort., even with different ids, there maynot be more than one element what results in the second element (in this case: remove[$i]) overwriting the first (in this case status[$i]).

class My_Form_Random extends Zend_Form {

public function init()
    $data = array(1 => 'test1', 2 => 'test2');
    foreach ($data as $field => $val)
        $this->addStatusElement($field, $field, $val);

    $this->addElement('submit', 'submit');


protected function addStatusElement($id, $label, $value)
    $element = new Zend_Form_Element_Select('add_'.$id);



protected function addRemoveElement($id)
    $element = new Zend_Form_Element_Checkbox('remove_'.$id);



Posted by Christian Albrecht (alab) on 2010-06-10T03:05:19.000+0000

Postponing for Zend Framework 2.0 development.

Have you found an issue?

See the Overview section for more details.


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

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