0
votes

I'm currently trying to create a form using Zend_Form. Inside the form there is a displayGroup of File element and Text element. Since it is a dynamic form, I would like the input field names to be in array form (something like the one below).

requestRow[1][fileName]
requestRow[1][fileDesc]
requestRow[2][fileName]
requestRow[2][fileDesc]

setElementsBelongTo() worked for the text elements but not on the File elements. Is it the correct behavior? Or do I need extra method call or attribute/property for that?

If it is the specification, is there any workaround for that?

I have also tried manually setting the File element name with array format but it also doesn't work.

I'm using Zend 1.12

Thank you in advance!

1

1 Answers

1
votes

Saw the following comment about the current limitation File element.

Posted by Thomas Weidner (thomas) on 2011-09-19T06:30:50.000+0000

No, this is a limitation of php's file upload capability. From ZF's manual:

{quote} File elements in Subforms

When you use file elements in subforms you must set unique names. For example, if you name a file element in subform1 "file", you must give any file element in subform2 a different name.

If there are 2 file elements with the same name, the second element is not be displayed or submitted.

Additionally, file elements are not rendered within the sub-form. So when you add a file element into a subform, then the element will be rendered within the main form. {quote}

Posted by Thomas Weidner (thomas) on 2011-09-29T18:11:15.000+0000

Closing as wont fix as there is actually no way to solve this limitation

http://framework.zend.com/issues/browse/ZF-11741