Last active
December 13, 2015 18:29
-
-
Save einarwh/4955948 to your computer and use it in GitHub Desktop.
Plumbing code to hook up Mkay to jQuery.Validate.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery.validator.addMethod("mkay", function (value, element, param) { | |
"use strict"; | |
var ruledata = JSON && JSON.parse(param) || $.parseJSON(param); | |
var validator = MKAY.getValidator(ruledata.rule, ruledata.ast); | |
return validator(); | |
}); | |
jQuery.validator.unobtrusive.adapters.add("mkay", ["rule"], function (options) { | |
"use strict"; | |
options.rules.mkay = options.params.rule; | |
options.messages.mkay = options.message; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment