Check if form is valid in angular


Topic: Check if form is valid in angular

osoverflow pro asked 7 years ago

Hi! I want to know how to check if a form is valid in angular, to disable/enable the submit button if the form is invalid. I'm using the form builder to do some validations and mdbInputValidate directive to validate fields, but I want to know how to verify that all inputs are valid before enabling the submit button.

Damian Gemza staff answered 7 years ago

Dear osoverflow, In your case, you have to use ReactiveForms to check if the whole form is valid or not. I've prepared instruction which shows how to use default angular validators and our custom validations. There you can find something like  Submit Validation. Implementing this allows you to check if every input in your forms are valid when you click on the button. Please use this doc: https://mdbootstrap.com/angular/components/input-validation/ If you will need more help, just let me know. Best Regards, Damian

shofiul answered 6 years ago

Link Does not work.

https://mdbootstrap.com/angular/components/input-validation/


Arkadiusz Idzikowski staff commented 6 years ago

The documentation structure slightly changed since then. Please try this one:

https://mdbootstrap.com/docs/angular/forms/validation/


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Resolved

Specification of the issue
  • User: Pro
  • Premium support: No
  • Technology: MDB Angular
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No