Task #5636

Task #26664: Clean up Form ViewHelpers

Task #26658: Make Form ViewHelpers consistent

Form_RadioViewHelper and CheckBoxViewHelper miss check for existing object before it is accessed.

Added by Steffen Ritter over 5 years ago. Updated over 1 year ago.

Status:Under Review Start date:2009-12-05
Priority:Must have Due date:
Assigned To:- % Done:

0%

Category:-
Target version:-
Has patch:No

Description

If you have an form for creating an Object currently this will fail with an exception.
The other FormViewHelper use the getValue() function to determine an property-value of object assigned to the form.
Since Checkbox/Radiobox has to compare against a value to decide if selected, they have to fetch the property-value on their own.

in getValue a check on $this->viewHelperVariableContainer->exists('Tx_Fluid_ViewHelpers_FormViewHelper', 'formObject') and an call to $this->addAdditionalIdentityPropertiesIfNeeded(); are performed before acessing the property. If you do so in RadioBox and Checkbox too, no exception anymore.

regards

Steffen

exceptionRadioCheckBox.diff Magnifier (1.7 kB) Steffen Ritter, 2009-12-05 18:13

radioProperty-5636.diff Magnifier - try/catch for exception (1017 Bytes) Peter Niederlag, 2011-02-03 18:27

radioProperty-5636.diff Magnifier - try/catch ( (962 Bytes) Peter Niederlag, 2011-02-03 18:30


Related issues

related to TYPO3.Fluid - Task #9214: Improve handling of bound properties in checkbox, radio a... Closed 2010-08-09

History

#1 Updated by Pascal Jungblut over 5 years ago

I can confirm this bug. The patch works fine for me. Thanks Steffen!

regards
Pascal

#2 Updated by Thomas Deinhamer over 5 years ago

I got a similar problem when trying to display a field
of TCA-type 'select' with items defined in the TCA.

The values of the field will get stored as CSV list
in the backend, so the type of the property in Extbase
is 'string'.

The problem is, that the checkbox viewhelper isn't aware
of handling this CSV list. If I enhance my model to return
an array, the whole thing will screw up when the model
gets persisted, as the SQL generated is something like:
"UPDATE table SET csv_field=()"

This happens if the field comes from a form, where
no checkboxes where selected.

Sorry for the sloppy description, but I'm not really aware
of where Extbase/Fluid messes this up or transforms the
variables into other types, etc. It's just I got huge
problems setting/getting 'select' fields (as defined in TCA)
inside my model, for displaying them with Fluid and persisting
them after form submission.

#3 Updated by Sebastian Kurfuerst about 5 years ago

  • Project changed from Extbase MVC Framework to TYPO3.Fluid

#4 Updated by Peter Niederlag over 4 years ago

IMO, the Fix by Steffen won't work on recent(>1.3.0) fluid versions. The issue needs to be tackled properly anyway as in #9214.
attached patch at least fixes the exception.

#5 Updated by Peter Niederlag over 4 years ago

updated patch.
Remove

$this->addAdditionalIdentityPropertiesIfNeeded();

from patch as it sneeked in there by accident

#6 Updated by Sebastian Kurfuerst about 4 years ago

  • Parent task set to #26658

#7 Updated by Mr. Hudson almost 4 years ago

Patch set 1 of change Ie8a02e019d67e8b7a3a01544e8a643dfaa507db0 has been pushed to the review server.
It is available at http://review.typo3.org/4413

#8 Updated by Mr. Hudson almost 4 years ago

Patch set 2 of change Ie8a02e019d67e8b7a3a01544e8a643dfaa507db0 has been pushed to the review server.
It is available at http://review.typo3.org/4413

#9 Updated by Mr. Hudson almost 4 years ago

Patch set 3 of change Ie8a02e019d67e8b7a3a01544e8a643dfaa507db0 has been pushed to the review server.
It is available at http://review.typo3.org/4413

#10 Updated by Robert Lemke almost 4 years ago

  • Target version changed from 1.0 beta 2 to 1.0.0

#11 Updated by Karsten Dambekalns almost 4 years ago

  • Target version deleted (1.0.0)

#12 Updated by Gerrit Code Review over 3 years ago

  • Status changed from New to Under Review

Patch set 4 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/4413

#13 Updated by Christian Müller over 3 years ago

  • Has patch set to No

maybe this ticket should be moved to the MVC project or closed?

#14 Updated by Michael Bakonyi almost 3 years ago

Is there any news about this issue? Unfortunately in 4.7.2 this problem still exists which might extbase/fluid show up like it was still in beta-state to extension-developers. Is it possible to sponsor parts of the fixing of this bug respectively integrating the offered patches into core?

#15 Updated by Daniel Siepmann almost 3 years ago

Using the rewritten property Mapper, adding the following three lines of code to the view helper helped me:

if ($this->configurationManager->isFeatureEnabled('rewrittenPropertyMapper') && $this->hasMappingErrorOccured()) {
    $propertyValue = (boolean)$this->getLastSubmittedFormData();
}

I added them right after assigning the line:

$propertyValue = $this->getPropertyValue();

I don't know whether this will work in all other situations.

Basically it does the same as all other fluid form fields like textfield.
It retrieves the content of the property in the current request.

Perhaps this will help some of you.

#16 Updated by Gerrit Code Review over 2 years ago

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

Also available in: Atom PDF