Hi, I'm trying to create a new custom validation method similar to the other methods included in 'additional-methods.js'. I've created my method like this: jQuery.validator.addMethod('dateAfter', function(value, element, param) { var dVal = new Date(); var dParam = new Date(); dVal.setTime(Date.parse(value)); param.indexOf('#') > -1 ? dParam.setTime(Date.parse(jQuery(param).val())) : dParam.setTime(Date.parse(param)); return !jQuery.validator.methods.required(value, element) || ((!/ Invalid|NaN/.test(dVal) && !/Invalid|NaN/.test(dParam)) && (dVal > dParam)); }, 'End date cannot be before start date.');
When running this method, it errors out while executing jQuery.validator.methods.required(value, element). This is because jQuery.validator.methods.required executes this.depend(param, element) which is not available to the newly created method. Has anyone found a way around this while creating custom validation methods?