Bug #99243
closedWrong behaviour when using property and value together
100%
Description
According to the docs, name and value should be ignored, if property is set. I`m using the view helper like this:
<f:form.textfield
id="{id}"
name="customName"
property="{property}"
value="customValue"
placeholder="{placeholder}"
class="input__field form-control{f:if(condition: '{class}', then: ' {class}')}"
errorClass="{errorClass}"
additionalAttributes="{additionalAttributes}"
data="{data}"
aria="{describedby: 'error-label-{id}'}"
/>
This is the result:
<input required="required" aria-describedby="error-label-email" class="input__field form-control" id="email" type="text" name="tx_myextension[customerData][email]" value="customValue">
The name attribute is ignored, but not the value attribute.
I´m not sure, what is wrong. Maybe the code, maybe the docs.
Inside the view helper, I found this part:
* The value is determined as follows:
* * If property mapping errors occurred and the form is re-displayed, the *last submitted* value is returned
* * Else the bound property is returned (only in objectAccessor-mode)
* * As fallback the "value" argument of this ViewHelper is used
if ($this->respectSubmittedDataValue) {
$value = $this->getValueFromSubmittedFormData($value);
} elseif ($this->hasArgument('value')) {
$value = $this->arguments['value'];
} elseif ($this->isObjectAccessorMode()) {
$value = $this->getPropertyValue();
}
I can fix this, if someone tells me, which would be the correct behaviour.
Updated by Gerrit Code Review almost 2 years ago
- Status changed from New to Under Review
Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/77681
Updated by Gerrit Code Review almost 2 years ago
Patch set 2 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/77681
Updated by Gerrit Code Review almost 2 years ago
Patch set 3 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/77681
Updated by Gerrit Code Review over 1 year ago
Patch set 4 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/77681
Updated by Gerrit Code Review over 1 year ago
Patch set 5 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/77681
Updated by Gerrit Code Review over 1 year ago
Patch set 6 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/77681
Updated by Simon Praetorius about 1 year ago
- Has duplicate Bug #93527: Assigned form-object does not overwrite default-values added
Updated by Gerrit Code Review 4 months ago
- Status changed from New to Under Review
Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/85413
Updated by Garvin Hicking 4 months ago · Edited
Previous patch has been abandoned with a discussion about "intentional behavior" of the "value" attribute.
One possible example why both attributes together may make sense is a form to edit a user. For the password field you would want to define property="password", but also value="" to not expose the current password hash to the form.
Thus, the new patch adjusts the inline code comment to reflect that intention.
Updated by Garvin Hicking 4 months ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset ca8f1f9f9240e80a222e99b7b404226f4caddf90.