From 4cd5c97fa8db2809c796f89062d06eade582ea55 Mon Sep 17 00:00:00 2001
From: ks129 <45097959+ks129@users.noreply.github.com>
Date: Mon, 8 Feb 2021 18:01:08 +0200
Subject: Rename invalid field IDs variable

---
 src/pages/FormPage.tsx | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

(limited to 'src/pages/FormPage.tsx')

diff --git a/src/pages/FormPage.tsx b/src/pages/FormPage.tsx
index ab74be9..8e998c5 100644
--- a/src/pages/FormPage.tsx
+++ b/src/pages/FormPage.tsx
@@ -205,7 +205,7 @@ function FormPage(): JSX.Element {
     async function handleSubmit(event: SyntheticEvent) {
         event.preventDefault();
         // Client-side required validation
-        const invalidFieldIds: number[] = [];
+        const invalidFieldIDs: number[] = [];
         questions.forEach((prop, i) => {
             const question: Question = prop.props.question;
             if (!question.required) {
@@ -215,12 +215,12 @@ function FormPage(): JSX.Element {
             prop.ref.current.validateField();
             // In case when field is invalid, add this to invalid fields list.
             if (prop.props.public_state.get("valid") === false) {
-                invalidFieldIds.push(i);
+                invalidFieldIDs.push(i);
             }
         });
 
-        if (invalidFieldIds.length) {
-            const firstErrored = questions[invalidFieldIds[0]];
+        if (invalidFieldIDs.length) {
+            const firstErrored = questions[invalidFieldIDs[0]];
             if (firstErrored && firstErrored.props.scroll_ref) {
                 firstErrored.props.scroll_ref.current.scrollIntoView({ behavior: "smooth", block: "center" });
             }
-- 
cgit v1.2.3

