Skip to content

Checkbox rendering depends on attribute order #140

@jrauh01

Description

@jrauh01

I have identified an issue where the order of attributes in the configuration array for a checkbox element affects whether it is rendered as checked or unchecked. This behavior is unexpected because the order of attributes in the array should not matter.

The following code works as expected, rendering the checkbox as checked:

$checkbox = $this->createElement(
    'checkbox',
    'checkbox-xy',
    [
        'class'          => 'autosubmit',
        'checkedValue'   => 'a',
        'uncheckedValue' => 'b',
        'value'          => 'a',
    ]
);

However, the following code renders the checkbox as unchecked, even though it should be checked:

$checkbox = $this->createElement(
    'checkbox',
    'checkbox-xy',
    [
        'class'          => 'autosubmit',
        'value'          => 'a',
        'checkedValue'   => 'a',
        'uncheckedValue' => 'b',
    ]
);

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions