[FIX] website: ensure the persistence of auto-fill of form fields
Before this commit, some editor options could break the autocompletion
of form fields. This commit ensures that auto-fillable fields remain
auto-fillable when using the editor. In addition, this commit improves a
test to ensure that this bug does not reappear.
Steps to reproduce the fixed issue:
- Go to the "contact us" page or drop a form in a page
- Edit an auto-fillable field of the form ("Your Name" for example)
- Change the label position of the field
- Save
-> The field is no longer auto-fillable.
task-2715201
closes odoo/odoo#90103
X-original-commit: 455e0cc58c7fa1e02ebaa19dd2f99d829ca6e302
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
This commit is contained in:
committed by
qsm-odoo
parent
8d0a63f355
commit
2eb23cccfb
@@ -1316,6 +1316,8 @@ options.registry.WebsiteFieldEditor = FieldEditor.extend({
|
||||
* @param {HTMLElement} fieldEl
|
||||
*/
|
||||
_replaceFieldElement(fieldEl) {
|
||||
const inputEl = this.$target[0].querySelector('input');
|
||||
const dataFillWith = inputEl ? inputEl.dataset.fillWith : undefined;
|
||||
const hasConditionalVisibility = this.$target[0].classList.contains('s_website_form_field_hidden_if');
|
||||
const previousName = this.$target[0].querySelector('.s_website_form_input').name;
|
||||
[...this.$target[0].childNodes].forEach(node => node.remove());
|
||||
@@ -1336,6 +1338,10 @@ options.registry.WebsiteFieldEditor = FieldEditor.extend({
|
||||
this._deleteConditionalVisibility(fieldEl);
|
||||
}
|
||||
}
|
||||
const newInputEl = this.$target[0].querySelector('input');
|
||||
if (newInputEl) {
|
||||
newInputEl.dataset.fillWith = dataFillWith;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Sets the visibility dependency of the field.
|
||||
|
||||
@@ -140,6 +140,12 @@ odoo.define('website.tour.form_editor', function (require) {
|
||||
content: "Complete Recipient E-mail",
|
||||
trigger: '[data-field-name="email_to"] input',
|
||||
run: 'text_blur test@test.test',
|
||||
}, {
|
||||
content: 'Edit the Phone Number field',
|
||||
trigger: 'input[name="phone"]',
|
||||
}, {
|
||||
content: 'Change the label position of the phone field',
|
||||
trigger: 'we-button[data-select-label-position="right"]',
|
||||
},
|
||||
...addExistingField('email_cc', 'text', 'Test conditional visibility', false, {visibility: CONDITIONALVISIBILITY, condition: 'odoo'}),
|
||||
|
||||
@@ -317,6 +323,10 @@ odoo.define('website.tour.form_editor', function (require) {
|
||||
content: 'Verify value attribute and property',
|
||||
trigger: '.s_website_form_field:eq(0) input[value="John Smith"]:propValue("Mitchell Admin")',
|
||||
},
|
||||
{
|
||||
content: 'Verify that phone field is still auto-fillable',
|
||||
trigger: '.s_website_form_field input[data-fill-with="phone"]:propValue("+1 555-555-5555")',
|
||||
},
|
||||
// Check that if we edit again and save again the default value is not deleted.
|
||||
{
|
||||
content: 'Enter in edit mode again',
|
||||
|
||||
Reference in New Issue
Block a user