Activation of Angular Formgroup validation

Asked

Viewed 319 times

-2

Hello I have a form using formGrupo!

When I click the confirm button it does not perform the validations, without any reaction in the fields......

inserir a descrição da imagem aqui

However, I would like that when I click on this button, it validates the fields and return the error messages... like this...

inserir a descrição da imagem aqui

Here is the formGroup code and htlm button call

inserir a descrição da imagem aqui

inserir a descrição da imagem aqui

1 answer

2


in the boot does so

<button [disabled]="myForm.invalid" .../>
  • So Eduardo, in this case my button will be disabled while my Form has not been fully validated, but in my case, I wish that by clicking the button he make this validation field by field and present the error message in case there is an invalid field

  • give a look at this link https://loiane.com/2017/08/angular-reactive-forms-trigger-validation-on-submit/

  • As always, thank you Eduardo, your answers are always accurate... It worked cool...

Browser other questions tagged

You are not signed in. Login or sign up in order to post.