If you have installed any addons like AdblockPlus in FF try after disabling it.
On Jun 20, 12:55 pm, happy oliver <[email protected]> wrote: > I found the form fields are disabled by the FF block items. > > Could someone help me for my questions? > > Thanks in advance. > > On Jun 18, 11:56 pm, happy oliver <[email protected]> wrote: > > > Hi, > > > Are there someone can point out why I cannot save the upload file path > > into database by default. > > > I customize my form showing as below. > > > At the Form class: > > class AdvertisementForm extends BaseAdvertisementForm > > { > > public function configure() > > { > > > parent::configure(); > > $this->offsetUnset('advertisement2photo_list'); > > > $this->setWidgets( > > array( > > 'title' => new sfWidgetFormInput(), > > 'category_id' => new > > sfWidgetFormPropelChoice( > > array('model' => > > 'category', > > 'add_empty' > > => ' Select category ', > > )), > > 'logo_path' => new sfWidgetFormInputFile > > ( > > array('label' => > > 'Company logo', > > )), > > 'message' => new sfWidgetFormInput() > > ) > > ); > > > $this->validatorSchema['category_id'] = new sfValidatorPropelChoice > > (array > > ('model' => 'category', 'column' => 'id', 'required' => true) > > ); > > > $this->widgetSchema->setLabels(array( > > 'category_id' => 'Category', > > 'message' => 'Weclome Message', > > 'announcement' => 'Ads Details', > > )); > > > $this->validatorSchema['logo_path'] = new sfValidatorFile(array( > > 'required' => false, > > 'path' => sfConfig::get('sf_upload_dir').'/ads/', > > 'mime_types' => 'web_images', > > )); > > > $this->getWidgetSchema()->setNameFormat('data[%s]'); > > $this->defineSfsListFormatter(); > > > } > > > protected function doSave($con = null) > > { > > > if (file_exists($this->getObject()->getLogoPath())) > > { > > unlink($this->getObject()->getLogoPath()); > > } > > return parent::doSave($con); > > } > > > At the action class: > > > protected function processForm(sfWebRequest $request, sfForm $form) > > { > > /* bind, validate and save form */ > > $form->bind($request->getParameter($form->getName()), > > $request->getFiles($form->getName())); > > > if ($form->isValid()) > > { > > $advertisement = $form->save(); > > $this->redirect('@advertise?action=show'); > > } > > } > > > When I used the above code, I saw the file was uploaded to the web > > folder, the database logo_path field is empty. > > > I don't know why it don't save the absoluted file path to database. > > > When I modified the function of doSave() > > > protected function doSave($con = null) > > { > > if (file_exists($this->getObject()->getLogoPath())) > > { > > unlink($this->getObject()->getLogoPath()); > > } > > > $file = $this->getValue('logo_path'); > > $filename = sha1($file->getOriginalName()).$file->getExtension > > ($file->getOriginalExtension()); > > $file->save(sfConfig::get('sf_upload_dir').'/ads/'.$filename); > > $this->getObject()->setLogoPath($filename); > > $this->getObject()->save(); > > return parent::doSave($con); > > } > > > Then , I saw the file path had been saved into database. > > > Can someone point my code's problem? > > > By the way , I must mention one issue I met it is very wired. > > > When I use the > > $this->getWidgetSchema()->setNameFormat('advertisement[%s]'); > > > At the Firefox 2.0.0.20. the form fields cannot been show up. At the > > IE 7, the form fields is normal. > > > so I must change the form name format to > > > $this->getWidgetSchema()->setNameFormat('data[%s]'); > > > It spent my several hours to figure out. I think there are some > > forbidden words in Firefox. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
