Hello, i was surprised when reading that setDefault does not exist in symfony 1.1. I downloaded it and you are right, there is no setDefault on sfWidgetSchema class, but i found one in sfForm :
/** * Sets a default value for a form field. * * @param string $name The field name * @param mixed $default The default value */ public function setDefault($name, $default) { $this->defaults[$name] = $default; $this->resetFormFields(); } So maybe you should try using $this -> setDefault() in your form class wich extends sfForm ? On Mar 7, 3:26 am, Lawrence Krubner <lkrub...@geocities.com> wrote: > On Mar 6, 7:39 am, Alan Bem <alan....@gmail.com> wrote: > > > Look at this example: > > > $this->setWidget('referer', new sfWidgetFormInputHidden()); > > $this->setDefault('referer', > > sfContext::getInstance()->getRequest()->getReferer()); > > Sorry, but that doesn't work. The "setDefault" method is only > available in symfony 1.2. I'm trying to figure out how to do this in > symfony 1.1.7 > > > > > On Fri, Mar 6, 2009 at 1:16 PM, Lawrence Krubner > > <lkrub...@geocities.com>wrote: > > > > I've tried this: > > > > $this->widgetSchema['date'] = new sfWidgetFormInputHidden(); > > > $this->widgetSchema['date']->setDefault(date("Y-m-d h:m:i")); > > > > but I get this error: > > > > Fatal error: Call to undefined method > > > sfWidgetFormInputHidden::setDefault() in /home/lawrence/public_html/ > > > bocahoops/lib/form/NewNewsForm.class.php on line 32 > > > > So I tried this: > > > > $this->widgetSchema['date'] = new sfWidgetFormInputHidden(array(), > > > array("value", date("Y-m-d h:m:i"))); > > > > And that didn't work either. > > > > How do I set a default value on a hidden input? > > > > I'm using Symfony 1.1.7 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@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 -~----------~----~----~----~------~----~------~--~---