Reputation: 115
I need the submit button to be disabled until all the form fields are filled. I have done the following in HTML file:
<button dlsButton class="pt-primary adconfig-button" (click)="testConnection()"
[disabled]="!adForm.form.valid" i18n>Test Connection</button>
and this in TS file:
this.adForm = this.formBuilder.group({
DnsDomain: ['', [Validators.required], [Validators.minLength(1)]],
UserName: ['', [Validators.required], [Validators.minLength(1)]],
Password: ['', [Validators.required], [Validators.minLength(1)]],
});
how can I make the button disabled it is still enable now
Upvotes: 0
Views: 208
Reputation: 4238
change [disabled]="!adForm.form.valid"
to [disabled]="!adForm.valid"
Upvotes: 1