diff --git a/src/app/components-small/template-details/template-details.component.html b/src/app/components-small/template-details/template-details.component.html index c3ea833..5b2777b 100644 --- a/src/app/components-small/template-details/template-details.component.html +++ b/src/app/components-small/template-details/template-details.component.html @@ -10,7 +10,8 @@

Template Tab

Name: - + + Invalid tab name! Description: diff --git a/src/app/components-small/template-details/template-details.component.ts b/src/app/components-small/template-details/template-details.component.ts index 932622b..35c6251 100644 --- a/src/app/components-small/template-details/template-details.component.ts +++ b/src/app/components-small/template-details/template-details.component.ts @@ -35,7 +35,7 @@ export class TemplateDetailsComponent implements OnInit { }; templateForm: FormGroup = this.fb.group({ - name: [this.initialValues.name, Validators.required], + name: [this.initialValues.name, [Validators.required, Validators.minLength(1)]], description: this.initialValues.description, sortKey: this.initialValues.sortKey, location: [this.initialValues.location, [Validators.required, isInSetValidator(Object.keys(TAB_GROUP_NAME_OVERRIDES))]] @@ -59,6 +59,9 @@ export class TemplateDetailsComponent implements OnInit { async onSubmit() { let findString: string; let response: ApiResponse | null; + if (this.templateForm.invalid) { + return; + } if (this.templateLink != null) { findString = "create"; response = await this.registry.getByApiLink(this.templateLink);