Add form data validation check & inform

This commit is contained in:
Ethanell 2021-03-09 17:22:08 +01:00
parent 3efa1beb4d
commit 0b88e625aa
2 changed files with 19 additions and 16 deletions

View file

@ -24,10 +24,12 @@ socket.on("getType", data => {
save.innerText = "Save";
save.addEventListener("click", ev => {
ev.stopPropagation();
if (form.reportValidity()) {
let data = {};
for (const e of new FormData(form))
data[e[0]] = e[1];
socket.emit("setTypeConfig", {type: type.type, configuration: data})
}
});
formRow.insertAdjacentElement("beforeend", save);

View file

@ -160,7 +160,7 @@ deckSelect.addEventListener("change", ev => {
document.getElementById("save").addEventListener("click", ev => {
ev.stopPropagation();
if (form.reportValidity()) {
let data = {};
for (const e of new FormData(form))
data[e[0]] = e[1];
@ -176,6 +176,7 @@ document.getElementById("save").addEventListener("click", ev => {
slot.data.options = data;
socket.emit("setSlot", {name: slot.name, data: slot.data, position: slot.position});
}
});
document.getElementById("delete").addEventListener("click", ev => {