Skip to content

Commit

Permalink
Add resetErrors method
Browse files Browse the repository at this point in the history
  • Loading branch information
jantoun-scottlogic committed Aug 6, 2024
1 parent 620312d commit 17af6e6
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/app/carbon-estimator-form/carbon-estimator-form.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,7 @@ export class CarbonEstimatorFormComponent implements OnInit {
this.errorSummary?.summary.nativeElement.focus();
return;
}
this.validationErrors = [];
this.showErrorSummary = false;
this.resetErrors();
const formValue = this.estimatorForm.getRawValue();
if (formValue.onPremise.serverLocation === 'unknown') {
formValue.onPremise.serverLocation = 'WORLD';
Expand All @@ -188,8 +187,7 @@ export class CarbonEstimatorFormComponent implements OnInit {

public resetForm() {
this.estimatorForm.reset();
this.validationErrors = [];
this.showErrorSummary = false;
this.resetErrors();
this.formReset.emit();
}

Expand Down Expand Up @@ -227,4 +225,9 @@ export class CarbonEstimatorFormComponent implements OnInit {

return validationErrors;
}

private resetErrors() {
this.validationErrors = [];
this.showErrorSummary = false;
}
}

0 comments on commit 17af6e6

Please sign in to comment.