-
Notifications
You must be signed in to change notification settings - Fork 996
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
CMS form data is not cleared from local storage after form is submitted #3719
Comments
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 The AJAX The This way, we'd keep both plugins nicely uncoupled - what do you think? |
I am not the JS pro, but sounds reasonable for me 😁 if you like, you can put that into a PR and let's see what our frontend guys think about that 🙂 |
fixed with #3753 |
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: