Hi, I want to ask a question, try to be as explanatory as possible.

I have a form that allows me to add, edit and delete an entity called
"Services. " I related to adding the record, there is no problem, by
contrast, runs great ... 

My problem starts when i edit a record, i can not find the right way to
avoid editing the registry take or detects that files are uploaded to the
server and therefore should not be considered.

I managed to identify the file when I edit the registry, with the following
code:

$services = new Application_Model_Services();
$service = $services->find($id);
$dataForm = $service->current()->toArray();
if ($dataForm['logotype'] != '')
{
    $logotype = $form->getElement('logotype');
    $logotype->setRequired(false);
    $logotype->removeDecorator('Description');
    $logotype->addDecorator('Description', array(
        'tag' => 'img', 
        'src' => 'http://mv.web.localhost/images/'.$dataForm['logotype'],
        'alt' => 'http://mv.web.localhost/images/'.$dataForm['logotype'],
        'title' => 'http://mv.web.localhost/images/'.$dataForm['logotype']
    ));
    $logotype->setDescription('.');
}

I can also disable the requirement of the image so you can pass the
validation of registry editing.

When the system is ready for editing, validation <<$form->isValid(...)>>
does not pass the files, the strangest thing is that returns no error, just
not edit.

if ($this->_request->isPost()) 
{
    $service = $services->find($id);
    $serviceData = $service->current()->toArray();
    $formData = $this->_request->getPost();
    //if ($form->isValidPartial($formData))
    if ($form->isValid($formData)) 
    {
        $where = $services->getAdapter()->quoteInto('id = ?', $id);
        $service = $services->update($formData, $where);
        $this->view->message = 'The service has been modified.';
    } else ....

Well, I hope you understand my problem, if not, blame Google Translate... 

Thanks!!!!!!!

-----
Gonzalo Valenzuela
Santiago, Chile
--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/Zend-Form-Element-File-Updating-a-form-with-a-file-field-tp3525161p3525161.html
Sent from the Zend Framework mailing list archive at Nabble.com.

-- 
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]


Reply via email to