Feature #38147

Suggested addition to SelectViewHelper - allowing prepend/append of child content to rendered option tag list

Added by Claus Due over 9 years ago. Updated about 9 years ago.

Should have
Start date:
Due date:
% Done:


Estimated time:
Has patch:


This is a simple but functional and useful addition to the SelectViewHelper. It adds two new boolean attributes: prependContent and appendContent. Setting one of these to TRUE (with preference for prependContent if both are TRUE) makes the ViewHelper either append of prepend the innerHTML.

It also removes the REQUIRED annotation from the $options tag - explanation of why this is good follows.

<f:form.select prependContent="TRUE">
    <option value="-1">I am the first value</option>
// outputs...
<select ...>
    <option value="-1">I am the first value</option>
    <option...> // all further options

Of course appendContent=TRUE places the first option below the others, not above.

Set to "should have" (but maybe should be "must have") because the select ViewHelper sorely lacks customization options (such as prefix to labels, special classes for special options etc) and this method allows 100% control over how options are rendered by simply leaving out the "options" argument and manually rendering the content of the select tag. Without this patch the only method of doing this is through Javascript which is complete overkill.

The logic should be solid enough to advocate the change of the options argument. It should make complete sense to the developer that, if options are left out, they either need to be supplied as an argument as per the Fluid standard - or defined as the content of the tag as per the HTML standard.

Patch performed on 4.5.2 sysext fluid source.

Also available in: Atom PDF