Bug #34682

Radio Button missing checked on validation error

Added by Kira Backes over 3 years ago. Updated over 1 year ago.

Status:Under Review Start date:2012-03-09
Priority:Should have Due date:
Assigned To:- % Done:

0%

Category:ViewHelpers
Target version:-
Has patch:No Affected Flow version:Git master

Description

The checked state of a radio button is not properly checked in the case of a validation error, this should be checked by comparing the value to the lastSubmittedFormData

History

#1 Updated by Bastian Waidelich over 3 years ago

  • Category set to ViewHelpers
  • Status changed from New to Needs Feedback

Can you provide more details please (code snippet, version(s) used, ..). This should work.
Is this maybe related to #33628 ?

Thanks

#2 Updated by Daniel Siepmann over 2 years ago

Perhaps it's the bug described in my blog post? http://blog.layne-obserdia.de/post/fix-radio-and-checkbox-for-fluid#comment-795695300
There is a bug fix in the post.

Or is this another issue? I noticed that submitted checkboxes and radio buttons aren't selected anymore.

So e.g. the checkbox is not selected initial.
I check it, submit the form and the form will be displayed again, on validation error, then the checkbox is no more checked.

I just fixed it for the rewritten property mapper and got the submitted value and did a compare.

#3 Updated by Benno Weinzierl about 2 years ago

This bug only happens for radio buttons with name="something" and not for radio buttons specified with property="something".

Looking at the code it seems almost like a intentional behaviour:

        if ($checked === NULL && $this->isObjectAccessorMode()) {
            if ($this->hasMappingErrorOccured()) {
                $propertyValue = $this->getLastSubmittedFormData();
            } else {
                $propertyValue = $this->getPropertyValue();
            }

                // no type-safe comparison by intention
            $checked = $propertyValue == $valueAttribute;
        }

$this->isObjectAccessorMode() is the problem...

#4 Updated by Gerrit Code Review about 2 years ago

  • Status changed from Needs Feedback to Under Review

Patch set 1 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/22272

#5 Updated by Gerrit Code Review over 1 year ago

Patch set 2 for branch master of project Packages/TYPO3.Fluid has been pushed to the review server.
It is available at https://review.typo3.org/22272

Also available in: Atom PDF