Skip to content

Commit

Permalink
added some general validation rules
Browse files Browse the repository at this point in the history
  • Loading branch information
moyesm committed Jun 3, 2015
1 parent 0865664 commit e9b8f0e
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/general-validation-rules.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
define(['knockout'], function(ko) {
'use strict';

ko.validation.rules['mustEqual'] = {
validator: function (val, otherVal) {
return val === otherVal;
},
message: 'The field must equal {0}'
};

ko.validation.rules['mustNotEqual'] = {
validator: function (val, otherVal) {
return val !== otherVal;
},
message: 'The field must not equal {0}'
};
});

0 comments on commit e9b8f0e

Please sign in to comment.