Actions
Bug #92599
closedOptionViewHelper
Start date:
2020-10-19
Due date:
% Done:
0%
Estimated time:
TYPO3 Version:
10
PHP Version:
7.2
Tags:
Complexity:
easy
Is Regression:
Sprint Focus:
Description
isValueSelected() in \TYPO3\CMS\Fluid\ViewHelpers\Form\Select\OptionViewHelper compares $value with $selectedValue.
$value is always a string. $selectedValue can be a integer too. So $value === $selectedValue returns false if $value is 3 (string) and $selectedValue is 3 (int).
In my case $selectedValue is the property status from a domain object (inquiry).
/**
* @var int
*/
protected $status;
the form is created by fluid
<f:form action="saveInquiry" object="{inquiry}" objectName="inquiry" arguments="{inquiry: inquiry, serializedFilter: serializedFilter}">
...
<f:form.select property="status">
<f:form.select.option value="1">{f:translate(key:'inquiry.status.1')}</f:form.select.option>
<f:form.select.option value="3">{f:translate(key:'inquiry.status.3')}</f:form.select.option>
<f:form.select.option value="4">{f:translate(key:'inquiry.status.4')}</f:form.select.option>
<f:form.select.option value="5">{f:translate(key:'inquiry.status.5')}</f:form.select.option>
<f:form.select.option value="6">{f:translate(key:'inquiry.status.6')}</f:form.select.option>
</f:form.select>
...
</f:form>
i have solved it by replacing === with ==
Updated by Benni Mack about 3 years ago
- Related to Bug #93801: The select Viewhelper isn't selecting the correct value from a domain model. added
Updated by Benni Mack about 3 years ago
- Status changed from New to Needs Feedback
This should be fixed with #93801 - can you confirm this?
Updated by Reindl Bernd about 3 years ago
Updated by Benni Mack about 3 years ago
- Status changed from Needs Feedback to Closed
Thanks for checking
Actions