Skip to content

Commit

Permalink
Accept null values from unrequired fields
Browse files Browse the repository at this point in the history
When input field is cleared or it consists of only white-space characters, 'null' will be sent as the payload
  • Loading branch information
HelNershingThapa committed Jul 24, 2022
1 parent c3f0777 commit 10bdd56
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions frontend/src/components/user/forms/personalInformation.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ function _PersonalInformationForm(props) {
type="text"
className={fieldClasses}
autoComplete="address-level2"
allowNull
parse={(value) => (!value.trim() ? null : value)}
/>
</div>
<div className="w-100 w-50-ns fl pl3-ns">
Expand All @@ -168,6 +170,8 @@ function _PersonalInformationForm(props) {
component="input"
type="text"
validate={composeValidators(isUrl)}
allowNull
parse={(value) => (!value.trim() ? null : value)}
>
{({ input, meta }) => (
<div>
Expand All @@ -184,6 +188,8 @@ function _PersonalInformationForm(props) {
component="input"
type="text"
validate={composeValidators(isUrl)}
allowNull
parse={(value) => (!value.trim() ? null : value)}
>
{({ input, meta }) => (
<div>
Expand All @@ -202,6 +208,8 @@ function _PersonalInformationForm(props) {
component="input"
type="text"
validate={composeValidators(isUrl)}
allowNull
parse={(value) => (!value.trim() ? null : value)}
>
{({ input, meta }) => (
<div>
Expand All @@ -218,6 +226,8 @@ function _PersonalInformationForm(props) {
component="input"
type="text"
validate={composeValidators(isUrl)}
allowNull
parse={(value) => (!value.trim() ? null : value)}
>
{({ input, meta }) => (
<div>
Expand Down

0 comments on commit 10bdd56

Please sign in to comment.