I use validation with validation-directive like this
input ... validation="required" validation-error-to="#displayError">
When I try to use
new validationService().checkFormValidity($scope.form)
I do not get any error messages.
Removing validation-to-error works. But that does not help me. :)
I figured that it is because validation-common.updateErrorMsg is not instantiated with the correct values for self (specifically self.validatorAttrs) since I define it using validation-directive, but checkFormValidity is in validation-service, of which I have just instantiated a new empty instance.
I have made a hack in checkFormValidity lines 110-113 by changing the following:
if(!!elm && elm.length > 0) {
ctrl.$setTouched(); // make the element as it was touched for CSS
self.commonObj.updateErrorMsg(form.$validationSummary[i].message, {valid: false, elm: elm, submitted: true});
}
to
if(!!elm && elm.length > 0) {
ctrl.$setTouched(); // make the element as it was touched for CSS
elm.blur()
}
This I assume is not a good idea, but it will fire the original validators that were registered on the controls...
I am at a loss how to get it to work, or if it is even supposed to work like I want it to :)
tlastad