openaq / openaq-metadata-editor

MIT License
1 stars 1 forks source link

Fix/53 Adds deselection option #55

Closed necoline closed 4 years ago

necoline commented 5 years ago

53 I added an option of 'Select One' at the top of the list. If selected, the 'Select One' option will add an empty value for that form option.

An empty string is not an acceptable value for the current validation set up as-is. I think an ideal fix would include an update of the validation-format here to allow for an empty string to be a valid value on optional properties.

In the meantime, I added a few lines to the validate function to

The goal of this is to match the format of undefined metadata values. (Currently if there is no value for say site-type, it doesn't exist on the metadata.

Part of getting this to work included moving validation to occur only on save. ( #52 ) @sethvincent I'm not sure I understand the value of validating on propUpdate. So my removal of the validate on that function might incur some unintended consequences that I can't identify at the time being.

If that is the case, let's discuss this further and I'll address the issue of 'Validate on Save' in a different PR to precede this.