Two independent validations for single angular reactive form

I am using angular v10 and angular forms of v10. There is a form and submit button for the same. Added validations and using form.valid to enable/ disable submit button. What I want is: consider 10 fields in a form and submit1 and submit2 buttons. 5 fields are required for submit1 button and when user submits the form with values in 5 fields then submit2 button will be displayed. But submit2 button needs to have 2 additional required fields along with exisitng 5 fields. Is there any way to provide 2 additional validations to form for only submit2 button.

Upvotes: 0

Views: 232

Answers (1)

As it is a long time and even I also did not find a solution, the approach I used is that

  1. First set of mandatory fields are displayed in the initial screen and form validators are used on that.
  2. Then after a click, a pop will be opened with second set of mandatory fields. In the above way, we are able to achieve the solution for validation on two forms(separated in approach).

Upvotes: 1

Related Questions