Fixed issues with auto complete not working correctly with form sync
This commit is contained in:
parent
6ecd356cc0
commit
804556b74d
@ -165,6 +165,9 @@ class GenericField extends HTMLElement {
|
|||||||
const me = this;
|
const me = this;
|
||||||
this.inputElement.addEventListener("keyup", (e) => {
|
this.inputElement.addEventListener("keyup", (e) => {
|
||||||
if (e.key === 'Enter') {
|
if (e.key === 'Enter') {
|
||||||
|
const event = new CustomEvent("change", {detail: me, bubbles: true});
|
||||||
|
me.dispatchEvent(event);
|
||||||
|
|
||||||
me.dispatchEvent(new Event("submit"));
|
me.dispatchEvent(new Event("submit"));
|
||||||
} else if (me.field.value !== e.target.value) {
|
} else if (me.field.value !== e.target.value) {
|
||||||
const event = new CustomEvent("change", {detail: me, bubbles: true});
|
const event = new CustomEvent("change", {detail: me, bubbles: true});
|
||||||
@ -177,6 +180,11 @@ class GenericField extends HTMLElement {
|
|||||||
me.dispatchEvent(event);
|
me.dispatchEvent(event);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.inputElement.addEventListener("blur", (e) => {
|
||||||
|
const event = new CustomEvent("change", {detail: me, bubbles: true});
|
||||||
|
me.dispatchEvent(event);
|
||||||
|
}, true);
|
||||||
|
|
||||||
this.container.appendChild(this.inputElement);
|
this.container.appendChild(this.inputElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -307,6 +315,16 @@ class GenericForm extends HTMLElement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
fieldElement.addEventListener("submit", async (e) => {
|
||||||
|
const isValid = await this.validate();
|
||||||
|
if (isValid) {
|
||||||
|
const saveResult = await this.submit();
|
||||||
|
if (saveResult.redirect_url) {
|
||||||
|
window.location.pathname = saveResult.redirect_url;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user