Add form data validation check & inform
This commit is contained in:
parent
3efa1beb4d
commit
0b88e625aa
2 changed files with 19 additions and 16 deletions
|
@ -24,10 +24,12 @@ socket.on("getType", data => {
|
||||||
save.innerText = "Save";
|
save.innerText = "Save";
|
||||||
save.addEventListener("click", ev => {
|
save.addEventListener("click", ev => {
|
||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
|
if (form.reportValidity()) {
|
||||||
let data = {};
|
let data = {};
|
||||||
for (const e of new FormData(form))
|
for (const e of new FormData(form))
|
||||||
data[e[0]] = e[1];
|
data[e[0]] = e[1];
|
||||||
socket.emit("setTypeConfig", {type: type.type, configuration: data})
|
socket.emit("setTypeConfig", {type: type.type, configuration: data})
|
||||||
|
}
|
||||||
});
|
});
|
||||||
formRow.insertAdjacentElement("beforeend", save);
|
formRow.insertAdjacentElement("beforeend", save);
|
||||||
|
|
||||||
|
|
|
@ -160,7 +160,7 @@ deckSelect.addEventListener("change", ev => {
|
||||||
|
|
||||||
document.getElementById("save").addEventListener("click", ev => {
|
document.getElementById("save").addEventListener("click", ev => {
|
||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
|
if (form.reportValidity()) {
|
||||||
let data = {};
|
let data = {};
|
||||||
for (const e of new FormData(form))
|
for (const e of new FormData(form))
|
||||||
data[e[0]] = e[1];
|
data[e[0]] = e[1];
|
||||||
|
@ -176,6 +176,7 @@ document.getElementById("save").addEventListener("click", ev => {
|
||||||
slot.data.options = data;
|
slot.data.options = data;
|
||||||
|
|
||||||
socket.emit("setSlot", {name: slot.name, data: slot.data, position: slot.position});
|
socket.emit("setSlot", {name: slot.name, data: slot.data, position: slot.position});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
document.getElementById("delete").addEventListener("click", ev => {
|
document.getElementById("delete").addEventListener("click", ev => {
|
||||||
|
|
Loading…
Reference in a new issue