Feature #44235

prependOption for SelectViewHelper

Added by Anja Leichsenring over 8 years ago. Updated over 8 years ago.

Should have
Start date:
Due date:
% Done:


Estimated time:
Has patch:


There is a continous demand for prepending the options list of a select box with a kind of 'empty' option.
Extbase fluid aims to provide this feature, find the ticket here: http://forge.typo3.org/issues/26595

Related issues

Has duplicate TYPO3.Fluid - Feature #46081: Suggested addition to SelectViewHelper - allowing prepend of child content to rendered option tag listClosed2013-03-07


Updated by Alexander Berl over 8 years ago

I really like the idea and I have my own select viewhelper providing a similar functionality. The only thing I'm unsure about is with collision of the manual option values with the values in the options parameter - these can not be detected automatically, ie. what about this case:

   $this->view->assign('options', array(0 => 'none', 1 => 'one', 2 => 'two'));

   <f:form.select property="property" options="{options}" prependContent="TRUE">
      <option value="0">---</option>

which would output this:
     <option value="0">---</option>
     <option value="0">none</option>
     <option value="1">one</option>
     <option value="2">two</option>

In cases where the option "none" would be logically distinct from "no selection", this would matter, since there is no chance to know what the user actually selected.

What about additional viewhelper arguments similar to the following:

<f:form.select property="property" options="{options}" optionValueField="uid" optionLabelField="name" noOption="TRUE" noOptionValue="0" noOptionLabel="---" />

where noOptionValue and noOptionLabel would be optional and default to empty values.

This should render like that:

  <option value="0">---</option>
  <option value="1">one</option>
  <option value="2">two</option>

Not sure how urgent the option to set this "noOption" value als last item is, but the "noOption" attribute could also be made to understand "prepend" and "append" as values.


Updated by Tymoteusz Motylewski over 8 years ago

This was already merged in CMS Fluid, so it would be great if you can forward port it to Flow Fluid.
See https://review.typo3.org/#/c/17276/


Updated by Bastian Waidelich over 8 years ago

  • Status changed from New to Accepted
  • Assignee set to Bastian Waidelich

I'll take care, thanks for adding the issue here!


Updated by Gerrit Code Review over 8 years ago

  • Status changed from Accepted to Under Review

Patch set 1 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/18526


Updated by Bastian Waidelich over 8 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

Also available in: Atom PDF