[TYPO3-mvc] Creating a select box with values from a different domain model

Jochen Rau jochen.rau at typoplanet.de
Wed Feb 24 12:39:10 CET 2010


Hi Søren,

On 24.02.10 10:11, Søren Malling wrote:
> I got a Fluid form where i would like to have a dropdown menu with
> values from a model different from the one my object is a part of.
>
> <f:form.select name="club" options="{clubArray}"
> optionValueField="uid" optionLabelField="name" />
>
> In my form I've set the object="{member}" but how I'm i suppose to add
> the entries from my Tx_Groupmembers_Domain_Model_Club model to the
> dropdown box?
>
> I've tried the following with no luck
>
> 	/**
> 	 * @var array
> 	 */
> 	protected $clubArray;
>
> 	/**
> 	 * Constructs a new Member
> 	 *
> 	 */
> 	public function __construct() {
> 		$this->clubArray = new Tx_Extbase_Persistence_ObjectStorage();
> 	}
>
> Is it the wrong way of initializing data from another model? And what
> would the right way be?


public function indexAction() {
	$this->view->assign('availableClubs', $this->clubRepository->findAll());
}

Let's assume you have a property "club" in your Member object.

<f:form.select property="club" options="{availableClubs}" 
optionValueField="uid"><select><option>###dummy###</option></select></f:form.select>

I hope i got the point.

Regards,
Jochen


More information about the TYPO3-project-typo3v4mvc mailing list