Bug #66588
closedPOST Data in selectviewhelper should have higher priority than "value" value
100%
Description
given the following fluid:
<f:form.select name="myname" options="{myoptions}" value="50" />
and submitting the form with an error, the item with value 50 is always selected no matter what other value i selected before.
I would call value a default value and not a "always select" value.
A workaround would of course be to make "value" also a variable and handle the default and overwrite stuff in controller but this is really ugly!
here lies the problem: https://git.typo3.org/Packages/TYPO3.CMS.git/blob/HEAD:/typo3/sysext/fluid/Classes/ViewHelpers/Form/AbstractFormFieldViewHelper.php#l106
first the value is checked if it exists but never $value = $this->getLastSubmittedFormData(); in the case value is not an object itself.
Expected result:
POST Data should be checked BEFORE the default value is returned.
If possible please backport this bug to older TYPO3 versions!
Updated by Simon Schaufelberger almost 10 years ago
example data for options in controller:
$options = array( 1 => one, 50 => fifty, 51 => fiftyone ); $this->view->assign('myoptions', $options);
Updated by Simon Schaufelberger almost 10 years ago
Same goes for TYPO3.Fluid package of course!
Updated by Simon Schaufelberger almost 10 years ago
patch idea for getValue for TYPO3 pre 6.0, below for > 6.0 ;)
if ($this->hasArgument('value')) { $request = $this->controllerContext->getRequest(); if ($request instanceof Tx_Extbase_MVC_Web_Request && $request->getMethod() === 'POST') { $value = t3lib_div::_POST($this->arguments['name']); } else { $value = $this->arguments['value']; } }
if ($this->hasArgument('value')) { $request = $this->controllerContext->getRequest(); if ($request instanceof \TYPO3\CMS\Extbase\Mvc\Web\Request && $request->getMethod() === 'POST') { $value = \TYPO3\CMS\Core\Utility\GeneralUtility::_POST($this->arguments['name']); } else { $value = $this->arguments['value']; } }
if this looks ok, I will push it to gerrit
Updated by Jan Helke almost 10 years ago
- Assignee set to Jan Helke
- Target version set to 7.3 (Packages)
- Sprint Focus set to On Location Sprint
Updated by Gerrit Code Review almost 10 years ago
- Status changed from New to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/39155
Updated by Gerrit Code Review almost 10 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/39155
Updated by Gerrit Code Review almost 10 years ago
Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/39155
Updated by Benni Mack over 9 years ago
- Target version changed from 7.3 (Packages) to 7.4 (Backend)
Updated by Christian Kuhn over 9 years ago
- Status changed from Under Review to New
The pending patch was abandoned, the approach does not work.
The issue is still valid, a good entry point is the patch that solved the same (or at least related) issue in flow: https://review.typo3.org/#/c/24794/
Updated by Simon Schaufelberger over 9 years ago
since this is merged in flow, can this be backported in this ticket?
Updated by Susanne Moog over 9 years ago
- Target version changed from 7.4 (Backend) to 7.5
Updated by Gerrit Code Review over 9 years ago
- Status changed from New to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/42298
Updated by Markus Günther over 9 years ago
I created a small test extension...
https://github.com/markusguenther/mg_testforms
Hope that helps a bit. I need to fix the unit tests a bit.
Updated by Gerrit Code Review over 9 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/42298
Updated by Gerrit Code Review over 9 years ago
Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/42298
Updated by Gerrit Code Review over 9 years ago
Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/42298
Updated by Markus Günther over 9 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 223e203f98c5d50d5764ba306f0628cb2be5beea.
Updated by Anja Leichsenring about 9 years ago
- Sprint Focus deleted (
On Location Sprint)
Updated by Riccardo De Contardi over 7 years ago
- Status changed from Resolved to Closed