You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the CMS contact form is filled out and submitted, I expect that the local storage that preserves the entered information is cleared and not shown to me again when I reload the page.
Actual behaviour
Currently, when I enter information into the contact form and submit, the form data is not cleared from local storage. If I navigate to the contact form page again (or re-open the contact form modal, if its embedded in one), the data that I previously entered and that was successfully submitted is still there.
How to reproduce
Go to CMS contact form page / open CMS contact form modal
Enter all required information and click on the "submit" button
Maybe we can introduce an event, that other JS plugins can emit and the preserver plugin is listening to. so custom submit-like stuff could also be handled.
I think I might've found a way where we don't need a custom event: we can probably just use the native reset event on forms.
The AJAX form-cms-handler.plugin.js could trigger a form reset (this.el.reset()) after submission, which even makes some sense semantically... the form is submitted via AJAX, and then the form itself is reset.
The form-preserver.plugin.js can then just clear the local storage on both submit and reset (which kind-of makes sense in any case - if a form is reset, we probably don't want to keep the information in local storage, anyway).
This way, we'd keep both plugins nicely uncoupled - what do you think?
PHP Version
8.2
Shopware Version
6.6.2.0
Expected behaviour
When the CMS contact form is filled out and submitted, I expect that the local storage that preserves the entered information is cleared and not shown to me again when I reload the page.
Actual behaviour
Currently, when I enter information into the contact form and submit, the form data is not cleared from local storage. If I navigate to the contact form page again (or re-open the contact form modal, if its embedded in one), the data that I previously entered and that was successfully submitted is still there.
How to reproduce
I believe the issue might have been introduced here, when support for the
form-preserver
plugin was added to the CMS contact form: aaa738d#diff-9ed3eaf8c4406035ef8cfe06470d5153e89e6e7c0b76b9f5c7337bce6361ee74R5The form preserver plugin binds itself to the
submit
event of the underlying form:shopware/src/Storefront/Resources/app/storefront/src/plugin/forms/form-preserver.plugin.js
Line 232 in 66e2069
However, the CMS form does an
event.preventDefault()
before it submits the data through AJAX:shopware/src/Storefront/Resources/app/storefront/src/plugin/forms/form-cms-handler.plugin.js
Line 62 in 66e2069
My assumption is that when the form is submitted, the
form-preserver
plugin never hears about it and thus never clears the localstorage cache.The text was updated successfully, but these errors were encountered: