From 1e526fd38a603ad76dfb8445b81d6a3979d16627 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bruno=20Ryb=C3=A1rsky?= Date: Wed, 15 May 2024 19:49:36 +0200 Subject: [PATCH] Add survey --- assets/script.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/assets/script.js b/assets/script.js index 09543de..548efdc 100644 --- a/assets/script.js +++ b/assets/script.js @@ -716,14 +716,19 @@ async function surveySubmit() { const satisfaction = document.querySelector('input[name="satisfaction"]:checked'); const functionality = document.querySelector('input[name="functionality"]:checked'); const content = document.querySelector('input[name="content"]:checked'); - const comment = document.querySelector('textarea[name="comment"]').value; - if (satisfaction && functionality && content && comment) { - doAction("/survey", { + const comment = document.querySelector('textarea[name="comment"]'); + if (satisfaction && functionality && content && comment.value) { + await doAction("/survey", { action: "surveySubmit", satisfaction: satisfaction.value, functionality: functionality.value, content: content.value, - comment: comment - }); + comment: comment.value + }, "Zaznamenané", + "Nastala chyba"); + satisfaction.checked = false; + functionality.checked = false; + content.checked = false; + comment.value = ""; } } \ No newline at end of file