Hi.
Sorry to disturb you but what's wrong in this snippet (require doesn't trigger an error if the field is empty)
// Upload Image $dir = Zend_Registry::get('dir'); $this->addElement('file', 'photo1', array( 'required' => true, 'title' => $translator->translate('form_Ads_Tooltip_Photo'), 'class' => 'input-file', 'destination' => $dir->uploads, 'validators' => array( array('Count', false, 1), array('Size', false, 2097152), array('Extension', false, 'jpg,pjpeg'), array('IsImage', false,'jpeg'), ), )); $upload = $this->getElement('photo1'); $upload->removeDecorator('Label'); $upload->removeDecorator('HtmlTag'); $upload->removeDecorator('DtDdWrapper'); $upload->addDecorator('Errors'); $upload->addDecorator('Description', array('placement' => 'prepend')); $upload->addFilter('Rename',$dir->uploads.'avatar_'.substr(sha1(uniqid(microtime())),0,10). '.jpg' );after in the class
$this->setDisableLoadDefaultDecorators(true); $this->setDecorators(array(array('ViewScript', array('viewScript' => 'affitto/adsForm.phtml'))));Thanks in advance
Bye
View this message in context: Zend_File_Transfer with custom decorator required field
Sent from the Zend MVC mailing list archive at Nabble.com.
没有评论:
发表评论