On Mar 6, 7:16 am, Lawrence Krubner <[email protected]> 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
Okay, apparently the setDefault() method only exists in Symfony 1.2,
not in 1.1.7. So I tried this;
$hiddenInput = new sfWidgetFormInputHidden();
$hiddenInput->attributesToHtml(array("value" => date("Y-m-d
h:m:i")));
$this->widgetSchema['date'] = $hiddenInput;
which gave me this HTML:
<input type="hidden" name="new_news[date]" value="0"
id="new_news_date" />
So I tried this:
$hiddenInput = new sfWidgetFormInputHidden();
$hiddenInput->setAttribute("value", date("Y-m-d h:m:i"));
$this->widgetSchema['date'] = $hiddenInput;
which gave me this HTML:
<input value="0" type="hidden" name="new_news[date]"
id="new_news_date" />
So how do I set the default value?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---