Issue Bug Closed

#72235Checked attribute not workling in Fluids' CheckboxViewHelper for non property values

Thomas Schlumberger 12/15/15, 12:20 updated 12/15/15, 13:29

Description

In case one wants to use the “checked” attribute of fluids CheckboxViewHelper via a condition or just by setting it to “true” it does not work.

Example:

<f:form name="data[mykey]" value="1" checked="{data.key} == 1"></f:form>

This is caused by a wrong check in the CheckboxViewHelper on line 112-114 as there’s always a string passed to the viewhelper

if ($checked === true) {
$this->tag->addAttribute(‘checked’, ‘checked’);
}

To solve this problem a typecast on “$checked” needs to be made.

if ((boolean)$checked === true) {
$this->tag->addAttribute(‘checked’, ‘checked’);
}

Reviews 1