[TYPO3-mvc] form.select add empty option
Claus Due
claus at wildside.dk
Mon Aug 29 19:41:12 CEST 2011
Hi Stefan,
Regarding this particular array_merge problem:
$themes = array_merge(Array('--' => ''), $themes->toArray());
Please note that this converts $themes from a QueryResult (or ObjectStorage, depending on how you fetch the data) into an array, which means you can no longer use the ->getFirst(), ->count() etc. methods. In Fluid this should make no difference, though, except to the PaginateWidget which requires a QueryResult.
Cheers,
Claus
On Aug 29, 2011, at 7:30 PM, Stefan Frömken wrote:
> I tried it already with array_merge. The errormessage sounds like: "argument 2 for array_merge is of type object but must be of type array".
>
> Am 29.08.2011 19:01, schrieb Bjoern Haverland:
>> Hi Stefan,
>>
>> try it with an array_merge operation in your controller.
>>
>> $this->view->assign('themes', array_merge(Array(Null), $yourThemes))
>>
>> Best regards
>>
>> Björn
>>
>> Am 29.08.2011 18:50, schrieb Stefan Frömken:
>>> Hello MVC-Team,
>>>
>>> I want to add a simple empty option to form.select. The result should
>>> look like this:
>>>
>>> <select ...>
>>> <option value="">--</option>
>>> ...
>>> </select>
>>>
>>> I tried it this way...but it don't works:
>>>
>>> <f:form.select options="{themes}" optionValueField="uid"
>>> optionLabelField="name" name="theme" value="--">
>>> <option value="">--</option>
>>> </f:form.select>
>>>
>>> Any other ideas?
>>>
>>> Stefan
>>> _______________________________________________
>>> TYPO3-project-typo3v4mvc mailing list
>>> TYPO3-project-typo3v4mvc at lists.typo3.org
>>> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc
>>>
>>
>
> _______________________________________________
> TYPO3-project-typo3v4mvc mailing list
> TYPO3-project-typo3v4mvc at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc
More information about the TYPO3-project-typo3v4mvc
mailing list