Skip to content

Instantly share code, notes, and snippets.

@wmh
Created January 28, 2015 05:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wmh/5b8794cc693f98a6b6cb to your computer and use it in GitHub Desktop.
Save wmh/5b8794cc693f98a6b6cb to your computer and use it in GitHub Desktop.
jquery validation & uploadfile plugin conflict
var fileInputStr = "<input type='file' class='ignore' id='" + fileUploadId + "' name='" + s.fileName + "' accept='" + s.acceptFiles + "'/>";
if(s.multiple) {
if(s.fileName.indexOf("[]") != s.fileName.length - 2) // if it does not endwith
{
s.fileName += "[]";
}
fileInputStr = "<input type='file' class='ignore' id='" + fileUploadId + "' name='" + s.fileName + "' accept='" + s.acceptFiles + "' multiple/>";
}
function delegate( event ) {
var validator = $.data( this[ 0 ].form, "validator" ),
eventType = "on" + event.type.replace( /^validate/, "" ),
settings = validator && validator.settings ? validator.settings : [];
if ( settings[ eventType ] && !this.is( settings.ignore ) ) {
settings[ eventType ].call( validator, this[ 0 ], event );
}
}
staticRules: function( element ) {
var rules = {},
validator = $.data( element.form, "validator" );
if ( validator && validator.settings && validator.settings.rules ) {
rules = $.validator.normalizeRule( validator.settings.rules[ element.name ] ) || {};
}
return rules;
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment