I wanted to set a default value for a hidden input. I'm using symfony
1.1, so I can't use setDefault(), as it was only introduced in 1.2.

To learn more about sfWidgetFormInputHidden, I look here:

http://trac.symfony-project.org/browser/branches/1.1/lib/widget/sfWidgetFormInputHidden.class.php

That doesn't tell me much, so I look at the parent class,
sfWidgetFormInput:

http://trac.symfony-project.org/browser/branches/1.1/lib/widget/sfWidgetFormInput.class.php

That doesn't tell me much so I look at the parent class:

http://trac.symfony-project.org/browser/branches/1.1/lib/widget/sfWidgetForm.class.php

This gives me the renderTag method:

public function renderTag($tag, $attributes = array())
{
  if (empty($tag))
  {
    return '';
  }

  $attributes = $this->fixFormId($attributes);

  return sprintf('<%s%s%s', $tag, $this->attributesToHtml
($attributes), self::$xhtml ? ' />' : (strtolower($tag) == 'input' ?
'>' : sprintf('></%s>', $tag)));
}

>From this, I would assume that I could set the value using an
attribute. So I tried this:

   $hiddenInput = new sfWidgetFormInputHidden();
   $hiddenInput->setAttribute("value", date("Y-m-d h:m:i"));
   $this->widgetSchema['date'] = $hiddenInput;

But that only gave me this:

          <input value="0" type="hidden" name="new_news[date]"
id="new_news_date" />

Perhaps, instead of an attribute, I should use an option? But what
option?

So I'm curious about two things:

1.) How do I set the default value for a hidden input?

2.) How do I get a list of all the options that can be handed to a
widget? The API says simply "@param array $options     An array of
options" but it never says what the options might be.





--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to