How can I get the values of a dynamic choice field and save them ?
This is my function :
public function configure()
{
$query = FillableTable::getInstance()->createQuery('fal')->addWhere('0 = 1 ');
$piecesChoices= RepaoTable::getInstance()->createQuery('rpo')->select('rpo.code_text')->execute();
$choices = array();
foreach ($piecesChoices as $choice)
{
$value = $choice->getCodeText();
$choices[$value] = $value;
}
$this->widgetSchema['simple1'] = new sfWidgetFormDoctrineChoice(array('model'=> 'Simple1'));
$this->widgetSchema['simple2'] = new sfWidgetFormDoctrineChoice(array('model'=> 'Simple2', 'query' => $query));
$this->widgetSchema['code_text']= new sfWidgetFormChoice(array(
'expanded' => true,
'multiple' => true,
'choices'=> $choices
));
//validation
$this->validatorSchema....
//
I presume you are referring to saving the user-selected values from the code_text
widget?
In your action, after the user POST/GETs your form you would have an array instead of a single value.
You can var_dump($request->getPostParameter('code_text'))
to see what happens.
You can do whatever you want with those values then.