diff --git a/src/components/formio/textfield.tsx b/src/components/formio/textfield.tsx index 287d1ba..cd21c2b 100644 --- a/src/components/formio/textfield.tsx +++ b/src/components/formio/textfield.tsx @@ -1,6 +1,6 @@ import clsx from 'clsx'; import {Field, useFormikContext} from 'formik'; -import {useContext, useRef} from 'react'; +import {useContext, useEffect, useRef} from 'react'; import {RenderContext} from '@/context'; import CharCount from '@/utils/charcount'; @@ -48,10 +48,13 @@ export const TextField: React.FC { + if (value === undefined || value === null) { + // Make sure value is valid + setFieldValue(name, ''); + } + }, [value]); + // XXX: this is only accepted in the form builder to get to (close to) vanilla form // builder feature parity - setting the value with mask placeholders is bad for