Skip to content

Commit

Permalink
Treat cleared fields as empty string rather than null
Browse files Browse the repository at this point in the history
react-final-form submitting attribute doesn't behave as expected when using allowNull props, so had to remove it
  • Loading branch information
HelNershingThapa committed Jul 26, 2022
1 parent 3525072 commit 74cf9d7
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions frontend/src/components/user/forms/personalInformation.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)}
/>
</div>
<div className="w-100 w-50-ns fl pl3-ns">
Expand All @@ -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 }) => (
<div>
Expand All @@ -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 }) => (
<div>
Expand All @@ -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 }) => (
<div>
Expand All @@ -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 }) => (
<div>
Expand Down

0 comments on commit 74cf9d7

Please sign in to comment.