//Dependency on the following
/*
function.js
jQuery ver 1.5.1
jquery.validationEngine.js
jquery.validationEngine-en.js
*/
//Singleton
ValidationDecorator = function() {
//Private
//commonly used custom validation enum of decorators for elements
var CUSTOM_VALIDATION_CLASS_ATTRIBS = {
//D - Date
//DT - DateTime
//RQ - Required Field
//RNG - Range - checks against a range
D: "validate[custom[dateFormat]",
//field must have correct date format
D_RQ: "validate[required,custom[dateFormat]",
//field must have correct date format and is *required*
D_RNG: "validate[dateRange[{0}],custom[dateFormat]]",
//field must have correct date format and date range
D_RQ_RNG: "validate[required,dateRange[{0}],custom[dateFormat]]",
//field must have correct date time format and date range and is *required*
DT: "validate[custom[dateTimeFormat]]",
//field must have correct date time format
DT_RQ: "validate[required,custom[dateTimeFormat]]",
//field must have correct date time format and is *required*
DT_RNG: "validate[dateTimeRange[{0}],custom[dateTimeFormat]]",
//field must have correct date time format and date range
DT_RQ_RNG: "validate[required,dateTimeRange[{0}],custom[dateTimeFormat]]" //field must have correct date time format and date range and is *required*
};
//_appendClassbindings - Used for late binding of validation decoration to element classes
//elementId- the element to bind
//the attributes to bind (see CUSTOM_VALIDATION_CLASS_ATTRIBS)
var _appendClassbindings = function(elementId, classAttribs) {
document.getElementById(elementId).className += classAttribs;
};
var _appendToValidationGroup = function(elementId, groupName, attrib) {
var attrib = CUSTOM_VALIDATION_CLASS_ATTRIBS.D_RNG.replace("{0}", groupName);
...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.