Skip to content

Commit

Permalink
Clear form errors when selecting blank vote
Browse files Browse the repository at this point in the history
  • Loading branch information
selankon committed Nov 15, 2024
1 parent 12d27f5 commit 9125fb2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/components/Process/ParitaryErc.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ type BlankChoiceStore = Record<string, string>
*/
export const ParitaryErcQuestionsForm = () => {
const { t } = useTranslation()
const { elections, isDisabled, setIsDisabled, isAbleToVote, loaded, voted, voting } = useQuestionsForm()
const { elections, isDisabled, setIsDisabled, isAbleToVote, loaded, voted, voting, fmethods } = useQuestionsForm()
const { formValidation, onInvalid } = useFormValidation()
const [globalError, setGlobalError] = useState('')
const styles = useMultiStyleConfig('ElectionQuestions')
Expand All @@ -123,7 +123,10 @@ export const ParitaryErcQuestionsForm = () => {

const disableForm = () => {
setIsDisabled((prevState) => {
if (!prevState) setGlobalError('')
if (!prevState) {
setGlobalError('')
fmethods.clearErrors()
}
return !prevState
})
}
Expand Down

0 comments on commit 9125fb2

Please sign in to comment.