[BUGFIX] Fixes errors that occur when the same form is used multiple times on the same page #247
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There are currently some issues when using the same form multiple times on the same page (tested with
TYPO3 v8.7.10andpowermail v5.5.0):This pull request fixes the issues the following way:
__ttcontentuidto the form containing the content element uid__ttcontentuidinFormController->forwardIfTtContentUidDoesNotMatchand forwarding toformActionif the uids do not matchPrefillViewHelpersand only prefill from GET / POST variables if the content uids do matchdata-powermail-ttcontentuidinstead ofdata-powermail-formI am storing the data array of the current content object into
GLOBALS['TSFE']->applicationDatafor two reasons (https://github.com/maechler/powermail/blob/develop/Classes/Controller/FormController.php#L478-L496):errorActionis called after the validation failed. TheerrorActionredirects to the referring actionformActionand thus the data array is missing whenformActionwants to render the template. That means that the hidden field__ttcontentuidcan not be filled in correctly when there are server side validation errors.PrefillViewHelpers, like this it is easily accessible. Another way would be to pass the data down fromForm.htmlto the field templates (e.g.Input.html), but that would have a bigger impact on existing code.If you have any suggestions to improve the code I would be happy to update the pull request.