ZF-5835: Zend_form_element_file has wrong name when is nested in subform

Issue Type: Bug Created: 2009-02-19T04:10:05.000+0000 Last Updated: 2009-08-09T14:10:02.000+0000 Status: Resolved Fix version(s): - 1.9.0 (31/Jul/09)

Reporter: Vita Plsek (winsik) Assignee: Thomas Weidner (thomas) Tags: - Zend_Form

Related issues: - ZF-5864



I have found bug in File element. when I put file element into subform, then it doesn't have proper name.

Code snipet:

<pre class="literal"> 
        $filesForm = new Zend_Form_SubForm();

        for ($h1=1;$h1<=5;$h1++) {
            $subForm = new Zend_Form_SubForm();
            $subForm->addElement('text', 'name', array(

            'filters'    => array('StringTrim' ),
            'validators'  => array('NotEmpty'),
            'label'      => 'Název ' ,


            $subForm->addElement('file', 'file', array(
            'filters'    => array('StringTrim', ),
            'label'      => 'Obrázek',
            'validators' => array (array('Size', false, 5*1024*1024),
                        array('Extension', false, 'jpg,png,gif'),




then text elements have the proper names like : new_files[1][name] , so should file element, bu it is still named only file instead of new_files[1][file]

View script produces code like :

<pre class="literal">

Název Obrázek label of File Element is properly set, but its id and name doesn't contain parent arrays. I have found that 1.7.5 should have support for FileElement in subforms, but there is still this issue.


Posted by Vita Plsek (winsik) on 2009-03-16T10:14:12.000+0000

I have probably discovered solution :

In Zend_Form_Decorator_File in the version 1.7.5, there is

$name = $element->getName();

on line 91

and there probably should be

$name = $element->getFullyQualifiedName();

Posted by Vita Plsek (winsik) on 2009-03-16T10:25:12.000+0000

Also for right id line 94

should be -

$attribs['id'] = $element->getId();

instead of original

$attribs['id'] = $name;;

Posted by Thomas Weidner (thomas) on 2009-08-09T14:10:01.000+0000

Closed as duplicate of ZF-5864. Read manual, FAQ and ZF-5864 for details.

Have you found an issue?

See the Overview section for more details.


© 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.