Manually trigger validation with valdr (AngularJS)

711 Views Asked by At

i am using valdr (https://github.com/netceteragroup/valdr) to validate my form with Angular. Since it only shows feedback messages after the user has clicked into an input, i would also like to display them if the user clicks the submit button. Is there any way to do that or trigger the validation manually?

1

There are 1 best solutions below

0
Thalaivar On

Here is a link which talks about your issue: https://github.com/netceteragroup/valdr/issues/63

The author has said to use $submitted flag https://docs.angularjs.org/api/ng/type/form.FormController

You would use something like this below to show your error messages on submit and not on when you come out of the input field.

<span class="help-inline" ng-show="submitted && 
            form.email.$error.email">Invalid email</span>