Hi. So why not to create 2 separate form classes which extend BaseVideoForm (or VideoForm — depends of your needs and ), fill their configure()method with application-specific code and use both in appropriate applications?
On Thu, Oct 7, 2010 at 01:55, Manu SW <[email protected]> wrote: > Hi, > > Sorry if this is a n00b question ... > > I would like to use the same form in both frontend and backend application > but I would need to change some widget types, depending on the application I > am using the form. > > For example I have the form definition: > > class VideoForm extends BaseVideoForm > { > public function configure() > { > parent::setup();//pkWidgetFormInputFilePersistent > //pkValidatorFilePersistent > $this->setWidgets(array( > 'object_id' => new sfWidgetFormInputHidden(), > 'user_id' => new sfWidgetFormInputHidden(), > 'media_file' => new sfWidgetFormInputFile(array( > 'label' => 'Mi Video', > //'file_src' => > '/uploads/media/'.$this->getObject()->getMediaFile(), > //'is_image' => false, > //'edit_mode' => false, > //'template' => '<div>%input%</div>', > )), > 'is_stream' => new sfWidgetFormInputHidden(), > 'date_created' => new sfWidgetFormInputHidden() > )); > .... > > > > I this definition is fine for the frontend definition but I would like to > change the 'object_id' and 'user_id' to be a sfWidgetFormChoice when I use > the form in the backend application. > > Any idea or pointer someone could give me about the best way to achieve > that? > > (that's an app I am maintaining in symfony 1.2.5) > > > Thanks ! > M. > > -- > If you want to report a vulnerability issue on symfony, please send it to > security at symfony-project.com > > 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]<symfony-users%[email protected]> > For more options, visit this group at > http://groups.google.com/group/symfony-users?hl=en > -- With the best regards, Andrei. -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com 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
