Skip to content
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

Conversation

davidblader
Copy link
Contributor

saving participant status without providing comments results in null being saved as a string
added checks around appends to FormData object to filter out nulls & undefineds

@davidblader davidblader added the Category: Bug PR or issue that aims to report or fix a bug label Jun 18, 2018
@davidblader davidblader added this to the 20.0 milestone Jun 18, 2018
@HenriRabalais
Copy link
Collaborator

Should this be done across all forms?

if (myFormData.hasOwnProperty(key) &&
myFormData[key] !== "" &&
myFormData[key] !== null &&
myFormData[key] !== undefined
Copy link
Collaborator

@HenriRabalais HenriRabalais Jun 18, 2018

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.

Copy link
Collaborator

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.

Copy link
Contributor

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?

Copy link
Contributor Author

@davidblader davidblader Jun 18, 2018

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

Copy link
Contributor

@ZainVirani ZainVirani Jun 18, 2018

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 🤔

@ZainVirani
Copy link
Contributor

@HenriRabalais

Should this be done across all forms?

Ideally, yes. I'm assuming that most forms already do something like this.

@driusan
Copy link
Collaborator

driusan commented Jun 18, 2018

This needs to be rebased

@driusan driusan merged commit 61cbb66 into aces:20.0-release Jun 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Bug PR or issue that aims to report or fix a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants