[BUGFIX] Submitted form data has precedence over value argument 98/42298/5
authorMarkus Guenther <mail@markus-guenther.de>
Wed, 5 Aug 2015 21:03:52 +0000 (23:03 +0200)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Thu, 6 Aug 2015 17:10:45 +0000 (19:10 +0200)
commit223e203f98c5d50d5764ba306f0628cb2be5beea
tree185ea50a5c11144f187a5ac7ee2fe90809ff9ed9
parent2d7e5f8532c3fec03cd4cb2c53c336cbf6fa042e
[BUGFIX] Submitted form data has precedence over value argument

This adjusts the behavior of all Form ViewHelpers so that any
submitted value is redisplayed even if a "value" argument has been
specified.

The issue with this, however, was that upon re-display of the form due
to property-mapping or validation errors the value argument had
precedence over the previously submitted value.

This is a breaking change if you expect the previous behavior of form
ViewHelpers always being pre-populated with the specified value
attribute / bound object property even when re-displaying the form upon
validation errors.
Besides this change deprecates
``AbstractFormFieldViewHelper::getValue()``. If you call that method in
your custom ViewHelpers you should use
``AbstractFormFieldViewHelper::getValueAttribute()`` instead and call
``AbstractFormFieldViewHelper::addAdditionalIdentityPropertiesIfNeeded()``
explicitly if the ViewHelper might be bound to (sub)entities.

The default usage of getValueAttribute() not respect the submitted form data, because not every viewhelper need
this feature. But you can enable the usage of the form data by setting the
AbstractFormFieldViewHelper::respectSubmittedDataValue to TRUE.

Change-Id: I05d9996df0a5594390ff7a005bbee7f2ceeb06bc
Resolves: #66588
Related: #34186
Releases: master
Reviewed-on: http://review.typo3.org/42298
Reviewed-by: Sascha Wilking <sascha.wilking@hmmh.de>
Tested-by: Sascha Wilking <sascha.wilking@hmmh.de>
Reviewed-by: Susanne Moog <typo3@susannemoog.de>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
17 files changed:
typo3/sysext/core/Documentation/Changelog/master/Deprecation-66588-POSTDataInSelectviewhelperShouldHaveHigherPriorityThanValueValue.rst [new file with mode: 0644]
typo3/sysext/fluid/Classes/ViewHelpers/Form/AbstractFormFieldViewHelper.php
typo3/sysext/fluid/Classes/ViewHelpers/Form/ButtonViewHelper.php
typo3/sysext/fluid/Classes/ViewHelpers/Form/CheckboxViewHelper.php
typo3/sysext/fluid/Classes/ViewHelpers/Form/HiddenViewHelper.php
typo3/sysext/fluid/Classes/ViewHelpers/Form/PasswordViewHelper.php
typo3/sysext/fluid/Classes/ViewHelpers/Form/RadioViewHelper.php
typo3/sysext/fluid/Classes/ViewHelpers/Form/SelectViewHelper.php
typo3/sysext/fluid/Classes/ViewHelpers/Form/SubmitViewHelper.php
typo3/sysext/fluid/Classes/ViewHelpers/Form/TextareaViewHelper.php
typo3/sysext/fluid/Classes/ViewHelpers/Form/TextfieldViewHelper.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Form/AbstractFormFieldViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Form/CheckboxViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Form/HiddenViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Form/RadioViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Form/SelectViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/FormViewHelperTest.php