-
Notifications
You must be signed in to change notification settings - Fork 51
Form Submission
nelsonomuto edited this page Sep 25, 2014
·
1 revision
This is related to issue #36 whereby you need to run validations before the user submits the form.
Basically trigger the runCustomValidations event on the scope. The ideal place to do this is in the submit button's click handler.
/* Trigger the runCustomValidations to ensure the form is evaluated before submission
*/
$scope.$broadcast('runCustomValidations');
This will cause validations to be ran on each element that has a custom validation directive. This will then accurately mark the form as valid or invalid ($scope..$valid) and also display any validation errors encountered.
For an example of a submit button handler look at the line 42 of https://github.com/angular-ui-form/validation/blob/master/app/scripts/controllers/main.js