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

Georgetown conditionally required fields #1980

Closed
wants to merge 5 commits into from

Conversation

alishaevn
Copy link
Collaborator

@alishaevn alishaevn commented Aug 25, 2023

DO NOT MERGE -- this is a pr to show scott at georgetown how an implementation of conditionally requiring fields can be done.


story

require either rights statement or rights notes be filled out on a generic work form

we do this by removing the intiial requirement on the rights statement input. otherwise, validateMetatdata remained false.

instead, on page load we verify if either field has data. if so, we carry on. if neither does, both are marked as required. from there, if one of the two fields is changed then it is marked as required while the other is removed as required.

if neither field has data and the form attempts to be saved (the save button will NOT be disabled), a popup will show up on the rights statement asking for it to be filled out.

TODO

make this unspecific to the generic work form.

Im not sure why this is not working, but I wanted to still be ablt to keep track of it in case I need it in the future.
…neric work form

we do this by removing the intial requirement on the rights statement input. otherwise, [validateMetatdata](https://github.com/samvera/hyrax/blob/main/app/assets/javascripts/hyrax/save_work/save_work_control.es6\#L148-L155) remained false.

instead, on page load we verify if either field has data. if so, we carry on. if neither does, both are marked as required. from there, if one of the two fields is changed then it is marked as required while the other is removed as required.

if neither field has data and the form attempts to be saved (the save button will NOT be disabled), a popup will show up on the rights statement asking for it to be filled out.

TODO: make this unspecific to the generic work form.
@alishaevn alishaevn closed this Jan 24, 2024
@orangewolf orangewolf deleted the georgetown-conditionally-required-fields branch August 26, 2024 22:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants