From 7c98b0108e5ec37f5d3f52bd71ab119ec8211bf4 Mon Sep 17 00:00:00 2001 From: Henri Remonen Date: Fri, 3 Mar 2023 14:15:23 +0200 Subject: [PATCH] Disbale form submit after already submitted --- .../components/InteractiveForm/RenderSurvey.tsx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/client/components/InteractiveForm/RenderSurvey.tsx b/src/client/components/InteractiveForm/RenderSurvey.tsx index 77638d86..d7d97941 100644 --- a/src/client/components/InteractiveForm/RenderSurvey.tsx +++ b/src/client/components/InteractiveForm/RenderSurvey.tsx @@ -1,7 +1,6 @@ import React, { useState } from 'react' import { Box, Button } from '@mui/material' import { useTranslation } from 'react-i18next' - import { InputProps } from '../../types' import SelectFaculty from './SelectFaculty' import RenderQuestions from './RenderQuestions' @@ -15,6 +14,7 @@ const RenderSurvey = ({ }: InputProps) => { const { t, i18n } = useTranslation() const classes = styles.cardStyles + const [disableForm, setDisableForm] = useState(false) const [showQuestions, setShowQuestions] = useState(false) if (!questions) return null @@ -37,6 +37,11 @@ const RenderSurvey = ({ return isFacultySelected && isAnyDimensionsSelected } + const submitFormData = (data: any) => { + setDisableForm(true) + handleSubmit(data) + } + return ( @@ -77,7 +82,11 @@ const RenderSurvey = ({ {t('openForm')} ) : ( - )}