diff options
author | 2021-02-08 18:01:08 +0200 | |
---|---|---|
committer | 2021-02-08 18:01:08 +0200 | |
commit | 4cd5c97fa8db2809c796f89062d06eade582ea55 (patch) | |
tree | 5e4c2f64c1d2178cbcc3f87621de7fcdf872f172 | |
parent | Improve submit data gathering (diff) |
Rename invalid field IDs variable
-rw-r--r-- | src/pages/FormPage.tsx | 8 |
1 files changed, 4 insertions, 4 deletions
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" }); } |