Thomas, Thanks for replying. 

That FAQ was a devil to find,
http://framework.zend.com/wiki/display/ZFFAQ/Forms for anyone who reads
this. 

this sugests this:

$element->setDecorators(array( 
    array('File'), 
    array('Errors') 
)); 



so, im not quite sure how to add a viewscript from that,  i ended up doing
this:

$element->addDecorators(array(
                                              array('ViewScript', 
                                                                                
array('viewScript' =>'_docupload.phtml',
                                                                                
                      'id' => 'imageElement'
                                                  )
                                                                    )
                                                                     )
                                                            );
but then it has two file elements (of course)  

I just did worked out how to do the same using setDecorators, but its
samesame. You can't have the form element in the viewscript, which means you
can't layout the element how you want.


I'm sure there is a way to set a viewscript and specify the upload element
in that viewscript?




thomasW wrote:
> 
> See the ZF FAQ section in our wiki.
> A file element must have a file decorator otherwise it can not be rendered 
> correctly.
> 
> Greetings
> Thomas Weidner, I18N Team Leader, Zend Framework
> http://www.thomasweidner.com
> 
> ----- Original Message ----- 
> From: "aSecondWill" <willjbar...@gmail.com>
> To: <fw-general@lists.zend.com>
> Sent: Friday, July 24, 2009 8:51 AM
> Subject: Re: [fw-general] file decorator not found, while present in
> latest 
> trunk - gets even stranger
> 
> 
>>
>>
>> Could someone tell me how to set the viewscript for my file elements now
>> then please? This used to work untill updating the framework:
>>
>> $element->setDecorators(array(
>>                               array('ViewScript',
>>         array('viewScript' =>'_docupload.phtml',
>>               'id' => 'imageElement'
>>                                                  )
>>                     )
>>      )
>>     );
>>
>> But now i get the file decorator not found error.
>>
>> Thanks
>>
>>
>>
>> Bart McLeod wrote:
>>>
>>> That is brilliant indeed,
>>>
>>> Bart
>>>
>>> Thomas Weidner schreef:
>>>> In past you would just have wondered why file uploads do not work.
>>>> Now you get an exception and are directly pointed to the problem. :-)
>>>>
>>>> Greetings
>>>> Thomas Weidner, I18N Team Leader, Zend Framework
>>>> http://www.thomasweidner.com
>>>>
>>>> ----- Original Message ----- From: "Bart McLeod" <mcl...@spaceweb.nl>
>>>> To: "fw-general" <fw-general@lists.zend.com>
>>>> Sent: Tuesday, February 10, 2009 9:56 AM
>>>> Subject: Re: [fw-general] file decorator not found, while present in
>>>> latest trunk - gets even stranger
>>>>
>>>>
>>>>> ok, was in my grouping definitions once more, I have to preserve the
>>>>> specific decorator for the file element
>>>>> -Bart
>>>>>
>>>>> Bart McLeod schreef:
>>>>>> But this testfile.php runs without any trouble:
>>>>>>
>>>>>> <?php
>>>>>>    require_once 'Zend/Loader.php';
>>>>>>    Zend_Loader::registerAutoLoad();
>>>>>>      $view = new Zend_View();
>>>>>>    $fileElement = new Zend_Form_Element_File('image');
>>>>>>    echo $fileElement->render($view);
>>>>>>
>>>>>> Beats me.
>>>>>> -Bart
>>>>>>
>>>>>> Bart McLeod schreef:
>>>>>>> both calls do no longer work in latest trunk:
>>>>>>>        $image = $this->createElement('file', 'image_upload',
>>>>>>> array('label' => 'image'));
>>>>>>> NOR
>>>>>>>        $image = new Zend_Form_Element_File('image_upload',
>>>>>>> array('label' => 'image'));
>>>>>>>
>>>>>>> This is the error:
>>>>>>> Exception caught by form: No file decorator found... unable to
>>>>>>> render file element
>>>>>>> Stack Trace:
>>>>>>> #0
>>>>>>> E:\ZendFramework\library\Zend\Form\Decorator\FormElements.php(101):
>>>>>>> Zend_Form_Element_File->render()
>>>>>>> #1 E:\ZendFramework\library\Zend\Form.php(2595):
>>>>>>> Zend_Form_Decorator_FormElements->render('')
>>>>>>> #2 E:\ZendFramework\library\SpaceCMS\Form.php(46):
>>>>>>> Zend_Form->render(NULL)
>>>>>>> #3
>>>>>>> E:\werk\cuddlefish\application\admin\models\forms\FormItem.php(93):
>>>>>>> SpaceCMS_Form->render(NULL)
>>>>>>> #4 E:\ZendFramework\library\Zend\Form.php(2610): FormItem->render()
>>>>>>> #5
>>>>>>> E:\werk\cuddlefish\application\admin\views\scripts\items\form.phtml(1):
>>>>>>> Zend_Form->__toString()
>>>>>>> #6 E:\ZendFramework\library\Zend\View.php(107):
>>>>>>> include('E:\werk\cuddlef...')
>>>>>>> #7 E:\ZendFramework\library\Zend\View\Abstract.php(787):
>>>>>>> Zend_View->_run('E:\werk\cuddlef...')
>>>>>>> #8
>>>>>>> E:\ZendFramework\library\Zend\Controller\Action\Helper\ViewRenderer.php(902):
>>>>>>> Zend_View_Abstract->render('items/form.phtm...')
>>>>>>> #9
>>>>>>> E:\ZendFramework\library\Zend\Controller\Action\Helper\ViewRenderer.php(923):
>>>>>>> Zend_ in E:\ZendFramework\library\Zend\Form.php on line
>>>>>>> 2615<br />
>>>>>>>
>>>>>>> While in the filesystem, I can see both the element and the
>>>>>>> decorator and I have autoloading enabled....
>>>>>>>
>>>>>>> Anyone? A few days ago, this element seemed to work, according to
>>>>>>> the posts here.
>>>>>>>
>>>>>>> Bart
>>>>>>>
>>>>>>>
>>>>>>
>>>>
>>>>
>>>
>>>
>>
>> -- 
>> View this message in context: 
>> http://www.nabble.com/file-decorator-not-found%2C-while-present-in-latest-trunk-tp21915154p24639508.html
>> Sent from the Zend Framework mailing list archive at Nabble.com. 
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/file-decorator-not-found%2C-while-present-in-latest-trunk-tp21915154p24672074.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to