Fix files not uploading when there is a required selectone component #10401
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it:
Fixes an issue with dataset field types that use controlled vocab, are only single select, and are required
Which issue(s) this PR closes:
Closes #10385
Special notes for your reviewer:
So it investigating this, I found that the selectOne simple fields had a required attribute, whereas no other fields did. Removing it fixed the issue AND validation still works correctly.
Looked in history, found it was added 5 years ago, but not to other fields - not sure why. Likely it was not actually needed (as validation is handled differently).
Here is what the attribute looked like before removing:
required="#{dsf.required and datasetPage}"
Suggestions on how to test this:
Use the CAFE metadatablock that has dataset field types that use controlled vocab, are only single select, and are required (or create a new one for testing). Add a new dataset and try to upload a file before filling out the metadata. Make sure it gets added to the list, and then also fill out metadata, and make sure everything gets saved correctly.
Also confirm that the field still acts as required (won't save without value, gets validation message)
Does this PR introduce a user interface change? If mockups are available, please link/include them here:
No
Is there a release notes update needed for this change?:
No, simple bug fix
Additional documentation: