Project

General

Profile

Actions

Bug #83229

closed

Selected-Attribute for OptionViewHelper not implemented properly

Added by Torben Hansen almost 7 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Fluid
Target version:
-
Start date:
2017-12-05
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
8
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

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.

Actions #1

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

Actions #2

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

Actions #3

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

Actions #4

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

Actions #5

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

Actions #6

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

Actions #7

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

Actions #8

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

Actions #9

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

Actions #10

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

Actions #11

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

Actions #12

Updated by Georg Ringer over 6 years ago

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

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

Actions #14

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

Actions #15

Updated by Georg Ringer over 6 years ago

  • Status changed from Under Review to Resolved
Actions #16

Updated by Benni Mack about 6 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF