From 74cf9d7751563c62cc8c7b14d528baa107cc7f09 Mon Sep 17 00:00:00 2001 From: Hel Nershing Thapa Date: Tue, 26 Jul 2022 11:47:09 +0545 Subject: [PATCH] Treat cleared fields as empty string rather than null react-final-form submitting attribute doesn't behave as expected when using allowNull props, so had to remove it --- .../components/user/forms/personalInformation.js | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/frontend/src/components/user/forms/personalInformation.js b/frontend/src/components/user/forms/personalInformation.js index 1c316306de..ac4ed43378 100644 --- a/frontend/src/components/user/forms/personalInformation.js +++ b/frontend/src/components/user/forms/personalInformation.js @@ -160,8 +160,7 @@ function _PersonalInformationForm(props) { type="text" className={fieldClasses} autoComplete="address-level2" - allowNull - parse={(value) => (!value.trim() ? null : value)} + parse={(value) => (!value.trim() ? '' : value)} />
@@ -181,8 +180,7 @@ function _PersonalInformationForm(props) { component="input" type="text" validate={composeValidators(isUrl)} - allowNull - parse={(value) => (!value.trim() ? null : value)} + parse={(value) => (!value.trim() ? '' : value)} > {({ input, meta }) => (
@@ -199,8 +197,7 @@ function _PersonalInformationForm(props) { component="input" type="text" validate={composeValidators(isUrl)} - allowNull - parse={(value) => (!value.trim() ? null : value)} + parse={(value) => (!value.trim() ? '' : value)} > {({ input, meta }) => (
@@ -219,8 +216,7 @@ function _PersonalInformationForm(props) { component="input" type="text" validate={composeValidators(isUrl)} - allowNull - parse={(value) => (!value.trim() ? null : value)} + parse={(value) => (!value.trim() ? '' : value)} > {({ input, meta }) => (
@@ -237,8 +233,7 @@ function _PersonalInformationForm(props) { component="input" type="text" validate={composeValidators(isUrl)} - allowNull - parse={(value) => (!value.trim() ? null : value)} + parse={(value) => (!value.trim() ? '' : value)} > {({ input, meta }) => (