Bug #83229
closedSelected-Attribute for OptionViewHelper not implemented properly
100%
Description
When you manually create a select field in Fluid and try to set/unset the selected attribute using the OptionViewHelper, the selected attribute will always be added to the HTML output.
The attribute is defined as boolean, thus I would expect, that selected="0"
would result in the option not to being rendered with the selected
attribute. But when I set the attribute as shown below, the selected attribute is rendered to the option tag.
Example:
<f:form.select id="mySelect" name="mySelect"> <f:form.select.option value="0" selected="0">Option1</f:form.select.option> <f:form.select.option value="1" selected="1">Option2</f:form.select.option> <f:form.select.option value="2" selected="0">Option3</f:form.select.option> </f:form.select>
I would expect, that only the 2nd option should be rendered with the selected
attribute and all others not, but the output is as following:
<select id="mySelect" name="tx_ext_plugin[mySelect]"> <option value="0" selected="">Option1</option> <option value="1" selected="1">Option2</option> <option value="2" selected="">Option3</option> </select>
This results in the 3rd option to be selected, since it is the last option-tag with the selected attribute.
You can also set the selected
attribute to an empty value, which also results in the selected
attribute being rendered, so the attribute can currently not be used, since when you set it to any value (even an empty string), the selected attribute will always be rendered to the option tag.
I suggest, that if the selected
attribute is given to the OptionViewHelper, it should render the attribute depending on the boolean value of the attribute.
Updated by Gerrit Code Review over 6 years ago
- Status changed from New to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/56431
Updated by Gerrit Code Review over 6 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/56431
Updated by Gerrit Code Review over 6 years ago
Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/56431
Updated by Gerrit Code Review over 6 years ago
Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/56431
Updated by Gerrit Code Review over 6 years ago
Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/56431
Updated by Gerrit Code Review over 6 years ago
Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/56431
Updated by Gerrit Code Review over 6 years ago
Patch set 7 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/56431
Updated by Gerrit Code Review over 6 years ago
Patch set 8 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/56431
Updated by Gerrit Code Review over 6 years ago
Patch set 9 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/56431
Updated by Gerrit Code Review over 6 years ago
Patch set 10 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/56431
Updated by Gerrit Code Review over 6 years ago
Patch set 1 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/57814
Updated by Georg Ringer over 6 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 4c0b457eb1c29e0998612603e141db07de7efadb.
Updated by Gerrit Code Review over 6 years ago
- Status changed from Resolved to Under Review
Patch set 2 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/57814
Updated by Gerrit Code Review over 6 years ago
Patch set 3 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/57814
Updated by Georg Ringer over 6 years ago
- Status changed from Under Review to Resolved
Applied in changeset 3e0de62401024d917fb73e830a2faf24cb26f201.