Skip to content
Snippets Groups Projects
Commit ac11470b authored by Soukéina Bojabza's avatar Soukéina Bojabza
Browse files

[FIX] website: reset a form properly for each submission success type


Before this commit, some behaviors of the forms after being submitted
were problematic:

- with the `On Success` option set on `Redirect`, when going back to a
form after submitting it (with the browser arrows), the fields were
still filled.
- with the `Show Message` option selected, when going in edit mode when
the message was displayed, the submit button was still "loading", even
after saving.

This commit solves this issues by properly resetting the form at each
start and restoring the submit button loading effect when the message is
displayed.

task-2798576

closes odoo/odoo#115540

Signed-off-by: default avatarVray Benjamin (bvr) <bvr@odoo.com>
parent 6c7385c7
No related branches found
No related tags found
No related merge requests found
......@@ -73,6 +73,10 @@ odoo.define('website.s_website_form', function (require) {
return res;
},
start: function () {
// Reset the form first, as it is still filled when coming back
// after a redirect.
this.$target[0].reset();
// Prepare visibility data and update field visibilities
const visibilityFunctionsByFieldName = new Map();
for (const fieldEl of this.$target[0].querySelectorAll('[data-visibility-dependency]')) {
......@@ -354,7 +358,7 @@ odoo.define('website.s_website_form', function (require) {
self.$target[0].classList.add('d-none');
self.$target[0].parentElement.querySelector('.s_website_form_end_message').classList.remove('d-none');
return;
break;
}
default: {
// Prevent double-clicking on the send button and
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment