From a1673f08057166ea971324b16f5077e20562c888 Mon Sep 17 00:00:00 2001 From: blankie Date: Mon, 23 Oct 2023 14:53:48 +1100 Subject: [PATCH] Check if new table columns and rows are not empty --- public/main.mjs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/public/main.mjs b/public/main.mjs index 4719c44..dd76485 100644 --- a/public/main.mjs +++ b/public/main.mjs @@ -124,6 +124,16 @@ function reloadTable() { +createDialog.addEventListener("input", function(event) { + if (event.target.value === "") { + event.target.setCustomValidity("Please enter a value"); + } else { + event.target.setCustomValidity(""); + } + + event.target.checkValidity(); +}); + createDialog.addEventListener("submit", function() { let columns = createDialog.querySelector("#cols").valueAsNumber; let rows = createDialog.querySelector("#rows").valueAsNumber;