Feature #44235
prependOption for SelectViewHelper
Status: | Resolved | Start date: | 2012-12-27 | |
---|---|---|---|---|
Priority: | Should have | Due date: | ||
Assigned To: | Bastian Waidelich | % Done: | 100% |
|
Category: | ViewHelpers | |||
Target version: | TYPO3 Flow Base Distribution - 2.1 | |||
Has patch: | No |
Description
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
Associated revisions
[FEATURE] Configurable prepend option for Select ViewHelper
A common use case with select fields is to have a 'empty' option at
first position in the options list.
This change provides the possibility to add a label and (optionally)
a value, which will be rendered in the option list.
Usage:
<f:form.select prependOptionLabel="select one" />
Note: The prepended option can be translated using the "translate"
argument.
Change-Id: I8d249d6cc7f0c802a53e85d54329f827cb82aba5
Resolves: #44235
Releases: master
History
#1 Updated by Alexander Berl over 2 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> </f:form.select>
which would output this:
<select> <option value="0">---</option> <option value="0">none</option> <option value="1">one</option> <option value="2">two</option> </select>
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:
<select> <option value="0">---</option> <option value="1">one</option> <option value="2">two</option> </select>
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.
#2 Updated by Tymoteusz Motylewski over 2 years ago
Hi,
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/
#3 Updated by Bastian Waidelich over 2 years ago
- Status changed from New to Accepted
- Assigned To set to Bastian Waidelich
I'll take care, thanks for adding the issue here!
#4 Updated by Gerrit Code Review over 2 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
#5 Updated by Bastian Waidelich over 2 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 4c58955fad2d25e98828e05ab3f1f6f4d4ec4ab3.