[TYPO3-english] how to: specify multiple selected items in a multi-select element using typo3 fluid?
Calgacus map Brude
calgach at gmail.com
Fri Feb 7 20:13:37 CET 2014
In fluid code like this, how do I specify which items are preselected?
<f:form.select name="coupon" options="{couponoptions}" multiple="true" size="10"/>
the couponoptions is an array with uid values and name label pairs defined like so:
$coupons = $this->couponRepository->findAll();
foreach($coupons as $coupon) {
$couponoptions[$coupon->getUid()] = $coupon->getName();
}
The options all show up but I don't know how to specify which are preselected.
The preselected items are found in php like so:
$old = $this->couponsAttachedRepository->findAll();
foreach($old as $o) {
$c = $o->getCoupon();
$couponsselected[$c->getUid()] = $c->getUid();
}
I would be happy to not use the f:form.select tag if I could get pass the options ina as a string like so {optionsstring} but when I try that the markup gets changed to html entities eg my < becomes '& lt;' etc. Is there way around that?
I am using typo3 v4.5.32 with fluid 1.3.
Thanks.
More information about the TYPO3-english
mailing list