Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified InstallPackages/knockout.validation_1.0.2.zip
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@

if (typeof (ko) === undefined) { throw 'Knockout is required, please ensure it is loaded before loading this validation plug-in'; }

if (typeof define === "function" && define["amd"]) {
exports = ko.validation = {};
}
// create our namespace object
var validation = exports;
ko.validation = validation;

var defaults = {
registerExtenders: true,
Expand Down Expand Up @@ -146,7 +146,7 @@
//#endregion

//#region Public API
var validation = (function () {
var api = (function () {

var isInitialized = 0;

Expand Down Expand Up @@ -453,7 +453,10 @@
contexts = null;
}
};
} ());
}());

// expose api publicly
ko.utils.extend(validation, api);
//#endregion

//#region Core Validation Rules
Expand Down Expand Up @@ -532,7 +535,7 @@

validation.rules['pattern'] = {
validator: function (val, regex) {
return utils.isEmptyVal(val) || val.match(regex) != null;
return utils.isEmptyVal(val) || val.toString().match(regex) != null;
},
message: 'Please check this value.'
};
Expand Down Expand Up @@ -739,7 +742,7 @@

//toggle visibility on validation messages when validation hasn't been evaluated, or when the object isValid
var visiblityAccessor = function () {
return isModified ? !isValid : false;
return (!config.messagesOnModified || isModified) ? !isValid : false;
};

ko.bindingHandlers.text.update(element, errorMsgAccessor);
Expand Down Expand Up @@ -1072,8 +1075,4 @@
};

//#endregion

/// apply our public api to the public object
ko.utils.extend(exports, validation);

}));