Consultez la FAQ sur le ZF avant de poster une question
Vous n'êtes pas identifié.
Pages: 1
Publié le 05/05/2009
Zend_Form has been lauded by many as a welcome addition to Zend Framework, and a flexible solution to the problem of forms. That said, one point of flexibility it offers has proved to be a pain point for many developers: decorators. This tutorial aims to shed some light on decorators, as well as provide strategies for creating your own decorators and combining them in creative ways to customize the output your forms generate.
Par Matthew Weier Ophinney
Lien: http://devzone.zend.com/article/3450
Hors ligne
Hello,
am using a Zend_Form_Element_File in my form.
but when i passed a decorator i got an error " Exception caught by form: No file decorator found... unable to render file element Stack Trace: #0 /var/www/pg/ividence/library/Zend/Form/Decorator/FormElements.php(101): Zend"
$file->setLabel($this->view->translate('Image'))->setRequired(false)
->setAttrib('id', 'news-image')
->addValidator('FilesSize', false, 10000)
->addValidator('ImageSize', false, array('minwidth' => 30, 'maxwidth' => 90, 'minheight' => 30, 'maxheight' => 90))
->addValidator('Extension', false, 'jpg,png,gif');
$form->setElementDecorators(array(
'ViewHelper',
'Description',
'Label',
'Errors',
new Zend_Form_Decorator_HtmlTag(
array('tag' => 'li','class'=>'news'))
), array('image'));
is there a way to pass the file upload element within an li tag like that
<li class="news">
<label>Image</label>
<input id="MAX_FILE_SIZE" type="hidden" value="2097152" name="MAX_FILE_SIZE"/>
<input id="news-image" type="file" name="image"/>
</li>
Hors ligne
Pages: 1