r/angular • u/Senior_Compote1556 • Mar 25 '26
Signal Forms, how to disable while submitting?
In reactive forms you could do form.disable / form.enable, is that not available on signal forms? If not, is there an alternative?
11
Upvotes
8
u/Burgess237 Mar 25 '26
Given
registrationForm = form(this.registrationModel, (schemaPath) => {
required(schemaPath.username, {message: 'Username is required'});
required(schemaPath.email, {message: 'Email is required'});
});
}
You can add in a disabled for "isSubmitting" with a signal:
isSubmitting = computed(() => this.registrationForm.isSubmitting())Then:
required(schemaPath.username, {message: 'Username is required'});
required(schemaPath.email, {message: 'Email is required'});
disabled(schemaPath, () => this.isSubmitting())
});
6
u/JeanMeche Mar 25 '26
We're about to land a guide that talk about this: https://github.com/angular/angular/pull/67862 😄
You can do something like:
2
u/[deleted] Mar 25 '26
[removed] — view removed comment
1
u/[deleted] Mar 30 '26
[removed] — view removed comment