Remote validation with kendo-validator
I am new to angular-js. I am developing an app using angular-kendo. I followed
- http://kendo-labs.github.io/angular-kendo/#/Validator
- http://www.telerik.com/forums/angular-kendo-validator .
Before implementing it in my real project, I will implement it in my text project. Look at my view:
<form role="form" name="formTimeLine" kendo-validator="validator"
k-options="myValidatorOptions">
<p>{{Welcome}}</p>
<span class="label required">Name:</span>
<input type="remarks" name="remarks" class="k-textbox"
ng-model="fiscalYear.Remarks" data-test="Please write sabbir."/><br>
<span data-for='remarks' class='k-invalid-msg'></span>
<button ng-click="Save()">Save</button>
</form>
My validation rules in the controller:
$scope.myValidatorOptions = {
rules: {
test: function (input) {
if (input.is("[name=remarks]")) {
return input.val() == "Sabbir"
} else {
return true;
}
}
},
messages: {
test: "Your UserName must be Sabbir"
}
};
My save function looks like this:
$scope.Save = function () {
//$scope.formTimeLine.$valid
if ($scope.validator.validate()) {
alert("Saved");
}
else {
alert("Error");
}
};
How can I wire up the rule using kendo-validator so that the remote validation is triggered and validated? It is said that a custom directive and is used ctrl.$setValidity('unique', false);
, but the call $scope.validator.validate()
returns true.
+3
source to share
No one has answered this question yet
Check out similar questions: