Using Symfony and Doctrine, I have a multi-select list box. The multiple default values need to be generated based on a Doctrine query.
$this->setWidgets(array(
'folders' => new sfWidgetFormDoctrineChoice(array(
'model' => 'FolderItem',
'order_by' => array('name', 'asc'),
'multiple' => true,
'query' => FolderItemTable::getUserInstance($user),
))
));
This gets me a list of all my folder items; however, I want them pre-selected by a list of Folders. For example, if I have Folder 1
containing item a
item b
and item c
and Folder 2
containing item d
and item e
; if Folder 1
is passed in I want item a
item b
and item c
to be selected, but I want item d
and item e
in the list but not selected (but selectable)