diff --git a/static/app.js b/static/app.js index 80e2f34..1763c19 100644 --- a/static/app.js +++ b/static/app.js @@ -82,9 +82,15 @@ function renderTable() { guestNameInput.maxLength = 50; guestNameInput.onchange = e => { let value = e.target.value; + // Allow clearing the guest name (empty string is valid) + if (value === "") { + delete data.guestNames[date]; + saveData(); + return; + } // Only allow plain text, disallow HTML/script tags, max 50 chars if (//.test(value) || /["'`\\]/.test(value)) { - alert("Guest name cannot contain code or special characters like <, >, \", \\\\, or backticks."); + alert("Guest name cannot contain code or special characters like <, >, \", \\, or backticks."); guestNameInput.value = data.guestNames[date] || ''; return; }