Set the validator for this specific field like this:
$this->validatorSchema['imagem'] = new sfValidatorFile(array(
'required' => $this->isNew(),
'path' => ...
...
));So the field is only required when it's a new object. Is that what you're looking for? Cheers, Daniel On Jan 7, 2010, at 8:52 PM, g0d br wrote: > Hi, > > I still having this problem. > > Im using sfWidgetFormInputFileEditable for a backend form and when i edit the > record with the image i have to choose the image file again otherwise i get > required error for the file. > > the problem is that i don wanna change the file but every time i have to > choose one file to overwrite the old one. > > Thank you for any help. > > Celso > > On Fri, Dec 11, 2009 at 12:27 PM, g0d br <[email protected]> wrote: > i get the error when i try to edit an record. > > create and delete works fine but if i try to edit an record and dont select > any file when i hit save the required error appears. > > Thanks > > Celso > > > On Fri, Dec 11, 2009 at 5:11 AM, Alexandru-Emil Lupu <[email protected]> > wrote: > When you get that required error? Better what are you trying to achieve? > > sent via htc magic > > >> On Dec 11, 2009 1:11 AM, "g0d br" <[email protected]> wrote: >> >> Hi, >> >> I have an schema like this: >> >> banner: >> id: ~ >> ordem: { type: integer, required: true } >> imagem: { type: varchar(255), required: true } >> link: { type: varchar(255), required: false } >> >> When i edit an record in admin module i get an error Required for imagem >> field. >> >> Thats the code in BannerForm.class.php >> >> parent::configure(); >> >> $this->widgetSchema['imagem'] = new sfWidgetFormInputFileEditable(array( >> 'label' => 'Imagem 630x288', >> 'file_src' => '/uploads/banner/'.$this->getObject()->getImagem(), >> 'is_image' => true, >> 'edit_mode' => !$this->isNew(), >> 'delete_label' => 'Remover imagem', >> 'template' => '<div>%file%<br />%input%<br />%delete% >> %delete_label%</div>', >> )); >> /* >> $this->widgetSchema['imagem'] = new sfWidgetFormInputFile(array( >> 'label' => 'Imagem 630x288', >> )); >> */ >> >> $this->validatorSchema['imagem'] = new sfValidatorFile(array( >> 'required' => true, >> 'path' => sfConfig::get('sf_upload_dir').'/banner', >> 'mime_types' => 'web_images', >> )); >> >> $this->validatorSchema['imagem_delete'] = new sfValidatorBoolean(); >> >> What an my doing wrong here? this code i get from symfony docs. >> >> Thank You >> >> >> Celso >> >> -- >> >> You received this message because you are subscribed to the Google Groups >> "symfony users" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/symfony-users?hl=en. > > -- > > You received this message because you are subscribed to the Google Groups > "symfony users" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/symfony-users?hl=en. > > > -- > You received this message because you are subscribed to the Google Groups > "symfony users" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/symfony-users?hl=en.--
You received this message because you are subscribed to the Google Groups "symfony users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en.
