views:

155

answers:

1

I have an embedded form with a choice widget. I'm trying to pass a default value from the main form to the widget. I'm trying to pass the value to the form as an option, then once I have it in the embedded form do I just do something like:

new sfwidgetformchoice(array(...,'default' => $this->getOption('default'))

doesn't seem to work

+1  A: 

No, in the form class:

$this->setDefault('YOUR_WIDGET_NANE', $this->getOption('default'));

Coronatus
Thanks, was still having problems, the choices array had integers as their key value, what ended up working was: $this->setDefault('widgetname', ''.$this->getOption('default')->getId())
if its not clear in that comment, the default value (an integer) needed to be changed into a string