0

I'm building a Zend_Form.Having:

$file=new Zend_Form_Element_File('file');
$file->setDescription('upload a picture:')
->setDestination(myPath);
$file->class="media[]";
$file->setDecorators(array(
'File',
array('Description',array('placement'=>'PREPEND','tag'=>'')),
array('HtmlTag',array('tag'=>'span','class'=>'myclass'))
));

I can't add the same element multiple times to the form with:

$form->addElements(array($file,$file));

Do I need to create a custom form_element_file class so that I can register the exact same element with the form more than once?How?

thanks

Luca

1 Answer 1

3

If you want to have more than one identical Zend_Form_Element_File elements in your form you can just setup setMultiFile method, e.g.

$file=new Zend_Form_Element_File('file');
$file->setMultiFile(2);
$form->addElement($file);

Hope this helps.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.