From 1d590a2411ae0781de1764797827c4dedf595b91 Mon Sep 17 00:00:00 2001 From: haraldnilsen Date: Sun, 7 Jan 2024 14:57:32 +0100 Subject: [PATCH] :poop: remember form answers --- frontend/src/routes/form/[slug]/+page.svelte | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/frontend/src/routes/form/[slug]/+page.svelte b/frontend/src/routes/form/[slug]/+page.svelte index 86ac919..06fd997 100644 --- a/frontend/src/routes/form/[slug]/+page.svelte +++ b/frontend/src/routes/form/[slug]/+page.svelte @@ -8,8 +8,10 @@ export let data; let formQuestion: string = "" - let questionAnswer1: string = "" - let questionAnswer2: string = "" + let questionAnswer1Text: string = "" + let questionAnswer1ID: number = 0 + let questionAnswer2Text: string = "" + let questionAnswer2ID: number = 0 let questionNumber: number = 0 // Reactive statement to react on 'data.slug' changes @@ -24,8 +26,10 @@ if (localstoragequestions) { let questions = JSON.parse(localstoragequestions).questions; formQuestion = questions[questionNumber].Question.QuestionText; - questionAnswer1 = questions[questionNumber].Answers[0].AnswerText; - questionAnswer2 = questions[questionNumber].Answers[1].AnswerText; + questionAnswer1Text = questions[questionNumber].Answers[0].AnswerText; + questionAnswer1ID = questions[questionNumber].Answers[0].AnswerID; + questionAnswer2Text = questions[questionNumber].Answers[1].AnswerText; + questionAnswer2ID = questions[questionNumber].Answers[1].AnswerID; } } @@ -39,8 +43,8 @@
{#key questionNumber} - - + + {/key}