Created
January 28, 2015 05:17
-
-
Save wmh/5b8794cc693f98a6b6cb to your computer and use it in GitHub Desktop.
jquery validation & uploadfile plugin conflict
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
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/>"; | |
} |
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
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 ); | |
} | |
} |
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
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