diff --git a/src/Roux/Html.hs b/src/Roux/Html.hs index 87657ae..62d2229 100644 --- a/src/Roux/Html.hs +++ b/src/Roux/Html.hs @@ -654,9 +654,11 @@ cookLogJs = , "var dateInput = document.getElementById('roux-record-date');" , "var commentInput = document.getElementById('roux-record-comment');" , "var errorEl = document.getElementById('roux-record-error');" + , "var activeBtn = null;" , "if (!btns.length || !modal || !form) return;" , "" , "function showModal() {" + , " activeBtn = this;" , " dateInput.value = new Date().toISOString().slice(0,10);" , " commentInput.value = '';" , " errorEl.style.display = 'none';" @@ -680,7 +682,8 @@ cookLogJs = , " e.preventDefault();" , " var date = dateInput.value;" , " var comment = commentInput.value;" - , " var filename = btn.dataset.filename;" + , " if (!activeBtn) return;" + , " var filename = activeBtn.dataset.filename;" , " var body = 'cooked-date=' + encodeURIComponent(date);" , " if (comment) body += '&comment=' + encodeURIComponent(comment);" , " var res = await fetch('/cook-log/' + encodeURIComponent(filename), {"