-
Notifications
You must be signed in to change notification settings - Fork 174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUGFIX] Fixes errors that occur when the same form is used multiple times on the same page #247
Conversation
…times on the same page
This is really a large change in powermail. At the moment it's a missing feature to have the same form twice on the same page, even if it's possible to use multiple powermail plugins on the same page. |
I see that this is a big change. However I think that this pull request changes as little as possible to make it work. I would be very happy if this or a similar fix finds its way into the core. |
I think this change looks good and has been well-tested. |
any update on this? |
I recognized the same problem on a customer page. Will this be fixed in the future? |
@mhirdes Applying the changes from my pull request should solve the issue, although I have not tested it with the most recent version of powermail. However it would still be nice if this fix or something similar would find its way into powermail. |
a31ca4e
to
43b5957
Compare
I know 6 1/2 years are a looong, loooong time from the start. 🙈 I am currently cleaning things up. Is this still an issue? If yes, would you mind to rebase the PR onto current master? If not, just close the PR or leave a short comment here. TIA |
Sorry for bugging ... there is #664 which is on an newer codebase. Closing it |
There are currently some issues when using the same form multiple times on the same page (tested with
TYPO3 v8.7.10
andpowermail v5.5.0
):This pull request fixes the issues the following way:
__ttcontentuid
to the form containing the content element uid__ttcontentuid
inFormController->forwardIfTtContentUidDoesNotMatch
and forwarding toformAction
if the uids do not matchPrefillViewHelpers
and only prefill from GET / POST variables if the content uids do matchdata-powermail-ttcontentuid
instead ofdata-powermail-form
I am storing the data array of the current content object into
GLOBALS['TSFE']->applicationData
for two reasons (https://github.com/maechler/powermail/blob/develop/Classes/Controller/FormController.php#L478-L496):errorAction
is called after the validation failed. TheerrorAction
redirects to the referring actionformAction
and thus the data array is missing whenformAction
wants to render the template. That means that the hidden field__ttcontentuid
can 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.html
to 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.