File tree Expand file tree Collapse file tree
src/app/submission/sections/form Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -80,3 +80,22 @@ would successfully complete:
8080
8181* Commented out the "codecov" job, because UMD does not have an appropriate key
8282 for uploading the results to codecov.io.
83+
84+ ## Change to Submission Form Validation Handling
85+
86+ The "updateForm" method in the "SubmissionSectionFormComponent" class
87+ (src/app/submission/sections/form/section-form.component.ts) has been
88+ modified to clear the form validation errors held by Angular when
89+ receiving a form update from the back-end.
90+
91+ This change is intended to fix an issue (see LIBDRUM-909) in which submitting
92+ a form without all the required fields populated would only show a brief
93+ "flash" of the validation errors, and then not show GUI validation
94+ warnings on all affected fields. This is apparently caused by a race condition
95+ between the Angular validation handling, and a page refresh triggered by the
96+ DSpace backend response.
97+
98+ It is unclear whether this is the optimal fix, so it has not been submitted
99+ upstream to DSpace. Also, DSpace has been working on various similar fixes, so
100+ the changes in this class should be re-evaluated on upgrades, and
101+ removed if possible.
Original file line number Diff line number Diff line change @@ -370,6 +370,20 @@ export class SubmissionSectionFormComponent extends SectionModelComponent {
370370 this . isUpdating = true ;
371371 this . formModel = null ;
372372 this . cdr . detectChanges ( ) ;
373+ // UMD Customization
374+ // Clear errors before calling initForm.
375+ // This is needed because this code path may be called multiple times,
376+ // and checksForErrors does a no-op (essentially clearing the
377+ // validation errors) if the "this.sectionData.errorsToShow" hasn't
378+ // changed.
379+ // Clearing the "errorsToShow" ensures that checksForErrors actually
380+ // shows the errors, no matter how many times this code block is called.
381+ //
382+ // Note: Future DSpace changes may eliminate the need for this change,
383+ // so it should be checked when doing DSpace upgrades, and removed,
384+ // if possible.
385+ this . sectionData . errorsToShow = [ ] ;
386+ // End UMD Customization
373387 this . initForm ( sectionData , errors , sectionState . serverValidationErrors ) ;
374388 this . checksForErrors ( errors ) ;
375389 this . isUpdating = false ;
You can’t perform that action at this time.
0 commit comments