Skip to content

Commit

Permalink
fix(*): display all errors of invalid fields upon pressing save
Browse files Browse the repository at this point in the history
fixes #476 (PR #477)
  • Loading branch information
RichardNutt authored Aug 4, 2020
1 parent 4bf4f9a commit 13d7ebc
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,10 @@ export class ChildDetailsComponent implements OnInit {
}

save() {
// errors regarding invalid fields wont be displayed unless marked as touched
this.form.markAllAsTouched();
this.validateForm = true;

if (this.form.valid) {
this.assignFormValuesToChild(this.child, this.form);

Expand All @@ -214,7 +217,9 @@ export class ChildDetailsComponent implements OnInit {
);
} else {
const invalidFields = this.getInvalidFields(this.form);
this.alertService.addDanger("Form invalid, required fields missing");
this.alertService.addDanger(
"Form invalid, required fields (" + invalidFields + ") missing"
);
}
}

Expand Down

0 comments on commit 13d7ebc

Please sign in to comment.