« Return to Thread: Disabling file upload field in form

Disabling file upload field in form

by Zoltan Lippai-2 :: Rate this Message:

Reply to Author | View in Thread

Hi,

I have a form, where I need to disable some items (the user can't  
modify it, but he can see the fields values)
When the user submits the form, before validating it, I set the  
initial values for the disabled fields, so this way I can be sure, that
a) The user can't modify any of the disabled fields values
b) The fields get their values (if a field is disabled, then zend_form  
won't see its value)

This way everything was fine, until I needed a file upload field. When  
it is disabled, I get the following error during form validation:

Fatal error: Uncaught exception 'Zend_File_Transfer_Exception' with  
message '"newFile" not found by file transfer adapter' in /jail/web/
projekter.lativus.com/Zend/File/Transfer/Adapter/Abstract.php:1254  
Stack trace:
#0 /jail/web/projekter.lativus.com/Zend/File/Transfer/Adapter/
Abstract.php(572): Zend_File_Transfer_Adapter_Abstract-
 >_getFiles('newFile')
#1 /jail/web/projekter.lativus.com/Zend/Form/Element/File.php(435):  
Zend_File_Transfer_Adapter_Abstract->isValid('newFile')
#2 /jail/web/projekter.lativus.com/Zend/Form.php(1985):  
Zend_Form_Element_File->isValid(NULL, Array)
#3 /jail/web/projekter.lativus.com/application/default/controllers/
TaskController.php(311): Zend_Form->isValid(Array)
#4 /jail/web/projekter.lativus.com/Zend/Controller/Action.php(503):  
TaskController->editAction()
#5 /jail/web/projekter.lativus.com/Zend/Controller/Dispatcher/
Standard.php(285): Zend_Controller_Action->dispatch('editAction')
#6 /jail/web/projekter.lativus.com/Zend/Controller/Front.php(934):  
Zend_Controller_Dispatcher_Standard->dispatch(O in /jail/web/
projekter.lativus.com/Zend/File/Transfer/Adapter/Abstract.php on line  
1254

I suppose the file upload fields value also doesn't get submitted, but  
I don't think setting some value for it before validation will work in  
this case.

Do you have any suggestions about dealing with this problem?

Thanks,
Zoltan

 « Return to Thread: Disabling file upload field in form