-
Notifications
You must be signed in to change notification settings - Fork 179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Candidate Parameters, Participant Status] 20.0 -- fix NULL form entry saves #3736
[Candidate Parameters, Participant Status] 20.0 -- fix NULL form entry saves #3736
Conversation
Should this be done across all forms? |
if (myFormData.hasOwnProperty(key) && | ||
myFormData[key] !== "" && | ||
myFormData[key] !== null && | ||
myFormData[key] !== undefined |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may be better to simply use myFormData[key] != null
vs myFormData[key] !== null && myFormData[key] !== undefined
here due to javascript coercion. http://webreflection.blogspot.com/2010/10/javascript-coercion-demystified.html
I will look into this more though to confirm.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After reading through it appears that myFormData[key] != null
would in fact be a more concise check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think myFormData will ever hold an object though, it would only hold values from the form, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After reading through it appears that myFormData[key] != null would in fact be a more concise check.
i would rather be explicit. i generally do not like using loose comparisons unless i have a good reason for doing so.
I don't think myFormData will ever hold an object though, it would only hold values from the form, no?
i don't think i know what you're talking about here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think I know what I'm talking about either.
My bad. I thought Henri was concerned about myFormData holding non primitive types, and then I overthought it 🤔
Ideally, yes. I'm assuming that most forms already do something like this. |
This needs to be rebased |
saving participant status without providing comments results in
null
being saved as a stringadded checks around appends to FormData object to filter out nulls & undefineds