Project

General

Profile

Actions

Bug #86164

closed

CheckboxViewHelper sets automatically each checkbox on checked, if just one of them is checked

Added by Julian Stelzer about 6 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Fluid
Target version:
Start date:
2018-09-06
Due date:
% Done:

100%

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

Description

If you want to use more than one checkbox in your form, for example a choice of categories in a simple FE-search and you set them like this.

<f:for each="{suche.options}" as="option" key="value">

     <f:form.checkbox property="category" multiple="true" value="{value}" id="check_{value}" />

  </f:for>

After you sent the form via POST just your selected checbox should be marked (checked="checked"), but instead all checkboxes after your last marked checkbox are marked too.

E.g.
______________________________
Your Search word: Example

cat 1 []
cat 2 [x]
cat 3 []
cat 4 []

-> you send this, but after reload with the values

Your Search word: Example

cat 1 []
cat 2 [x]
cat 3 [x]
cat 4 [x]

-> cat 2-4 are marked too.
________________________________

The problem seems to be the CheckBoxViewHelper. The following code doesn't remove the checked tag from the next checkboxes.

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

So if I add the else-case, it works as it should.

        if ($checked === true) {
            $this->tag->addAttribute('checked', 'checked');
        }
        else {
            $this->tag->removeAttribute( 'checked');
        }

The bug was first located in TYPO3 9.3 ( I don't know, if it was there earlier)


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #86890: AbstractTagBasedViewHelper recycles the TagBuilderClosed2018-11-08

Actions
Actions

Also available in: Atom PDF