-
Notifications
You must be signed in to change notification settings - Fork 499
Fix type-bind submission form validation handling #4725
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
Fix type-bind submission form validation handling #4725
Conversation
42e3bf3 to
7cfc736
Compare
426eb2f to
9244c24
Compare
|
Our data model requires type-bind for many fields in the locally defined submission forms. Before this fix, Angular validation did not work properly for blocks where the same field was configured multiple times with different properties for different types. This fix completely resolved the issue, and Angular validation now behaves as expected. We are currently running DSpace-CRIS version 2024.02.01. Thank you @kshepherd. |
nwoodward
left a comment
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.
👍 Thanks @kshepherd. This PR fixes the errors and warnings with type-bind fields in the submission form for me.
|
Backport failed for Please cherry-pick the changes locally and resolve any conflicts. git fetch origin dspace-7_x
git worktree add -d .worktree/backport-4725-to-dspace-7_x origin/dspace-7_x
cd .worktree/backport-4725-to-dspace-7_x
git switch --create backport-4725-to-dspace-7_x
git cherry-pick -x c47d988bca3d0542a7632570c0bdef3dbf6b7ca3 9244c24d118f3a6af1d30ee97f15f6ee43909650 f16dda82554f3d256df3d042ff2134cf6999b112 |
|
Successfully created backport PR for |
|
Successfully created backport PR for |
|
@kshepherd : If this should be ported to 7.x, then it looks like we'll have to do that manually. The automatic backport failed |
References
Fixes #2742 and #2572
Description
Fixes an issue with submission section form validation, where fields that are both "required" but also hidden by type-bind (for the current submission based on dc.type) are still validated by the Angular
requiredvalidator and causing the section to be marked as not valid / display the warning symbol, even though it is successfully validated by the server and can be deposited.The fix for this is to disable the fields as well as simply hiding them, so they are skipped by the Angular validation process.
To reproduce the problem:
(modify type-bind value to suit your own value pair or vocabulary for dc.type, or just set dc.type to onebox for testing)
Make sure you have some other fields in the same form, preferably one or more required fields that are NOT type-bound so you can test normal data entry.
Changes
getTypeBindRelationsin addition to MATCHER_VISIBLE, which means that fields not allowed by type bind will be both disabled and hiddengetTypeBindRelationsinto a utility function (in a separate file to avoid circular dependencies) and update the inline documentationChecklist
This checklist provides a reminder of what we are going to look for when reviewing your PR. You do not need to complete this checklist prior creating your PR (draft PRs are always welcome).
However, reviewers may request that you complete any actions in this list if you have not done so. If you are unsure about an item in the checklist, don't hesitate to ask. We're here to help!
mainbranch of code (unless it is a backport or is fixing an issue specific to an older branch).npm run lint