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 ==
Actions