Is a problem to set this default filter value in the profilesGeneratorConfiguration class? ... create a method getFilterDefaults() and return an array with default filter values.
Or you need to set this in the action? On 16 ún, 13:42, Javier Garcia <tirengar...@gmail.com> wrote: > Hi, > > i have tried this: > > $this->filter = new BirthdayFormFilter(); > $this->filter->setDefault('name', 'Peter'); > > and this: > > $a = array('name' =>'Peter'); > $this->filter = new BirthdayFormFilter($a); > > but they didn't work... > > I forgot to say i want to give the default value inside an action. > > Here you have the codes: > > In actions.class.php: > > public function executeIndex(sfWebRequest $request) { > > $this->birthday_list = Doctrine::getTable('Birthday') > ->createQuery('a') > ->execute(); > > $a = array('name' =>'Peter'); > $this->filter = new BirthdayFormFilter($a); > > } > > and indexSuccess.php contents: > > <?php echo form_tag('birthday/filtrar') ?> > > <?php echo $filter; ?> > > <div><?php echo submit_tag('Filter') ?></div> > </form> > > Javi > > On Feb 15, 7:28 pm, Florian <sideral.undergro...@gmail.com> wrote: > > > > > Hello, > > > To my mind, you should use this method: > > > {{{ > > > $this->filter->setDefault('name', 'Peter'); > > > }}} > > > It's more correct, because semantically, you want set a default value > > to your form, not to your model object! > > > But if you want to set use the contructor of the sfFormFilter > > > BaseForm > sfFormSymfony, see it's signature: > > > public function __construct($defaults = array(), $options = array(), > > $CSRFSecret = null); > > > So you can pass an *array* of default values as first argument. > > > It's different from your Birthday form, which inherits from > > sfFormDoctrine, see it's signature: > > > public function __construct($object = null, $options = array(), > > $CSRFSecret = null) > > > here, the first argument has to be null OR a Doctrine ActiveRecord / > > Object. > > > Hope it helps! > > > /Florian > > > On 15 fév, 16:49, "NOOVEO - Christophe Brun" <c.b...@nooveo.fr> wrote: > > > > I am working on the 'list' view of a module. > > > The filtered list is displayed via a call to the executeFilter() method, > > > as usual. > > > > Now, I create a route and the appropriate method myModuleActions : > > > > public function executeUseMyFilter(sfWebRequest $request) { > > > $id = $this->getRoute()->getObject()->getId(); > > > > // force the filter value to myotherobj_id = #the id in the route // > > > // ?????????????????? // > > > > return $this->executeFilter($request); > > > > } > > > > But I can't find the way to modify the filters and to force the > > > exceuteFilter() method to display only the list of objects having > > > myotherobj_id = $id. > > > > ________________________________ > > > > De : symfony-users@googlegroups.com > > > [mailto:symfony-us...@googlegroups.com] De la part de Javier Garcia > > > Envoyé : lundi 15 février 2010 14:23 > > > À : symfony-users@googlegroups.com > > > Objet : [symfony-users] Trying to give a default value to a filter form > > > > Hi, > > > > im trying to give a default value to a field of a filter. > > > > I have no problems giving a default value to a form this way: > > > > $m = new Birthday(); > > > $m->setName('Peter'); > > > $this->filter = new BirthdayForm($m); > > > > But when i try this: > > > > $m = new Birthday(); > > > $m->setName('Peter'); > > > $this->filter = new BirthdayFormFilter($m); > > > > this error appears: > > > > Warning: array_merge() [function.array-merge > > > <http://rs.localhost/frontend_dev.php/function.array-merge> ]: Argument > > > #2 is not an array in > > > /opt/lampp/htdocs/rs/lib/vendor/symfony/lib/form/sfForm.class.php on line > > > 1023 > > > > Any idea? > > > > Javi > > > > -- > > > You received this message because you are subscribed to the Google Groups > > > "symfony users" group. > > > To post to this group, send email to symfony-us...@googlegroups.com. > > > To unsubscribe from this group, send email to > > > symfony-users+unsubscr...@googlegroups.com. > > > For more options, visit this group > > > athttp://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 symfony-us...@googlegroups.com. To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en.