Permalink
Browse files

Merge pull request #290 from everplays/namespace-support-funccall_iss…

…ue269

Namespace support for funcCall validator - fixes #269
  • Loading branch information...
2 parents 891209b + 802d638 commit f5e2d4117f81cd221b0fba88a37a9743db83c034 @posabsolute committed Mar 2, 2012
Showing with 13 additions and 1 deletion.
  1. +13 −1 js/jquery.validationEngine.js
@@ -716,7 +716,19 @@
*/
_funcCall: function(field, rules, i, options) {
var functionName = rules[i + 1];
- var fn = window[functionName] || options.customFunctions[functionName];
+ var fn;
+ if(functionName.indexOf('.')>-1)
+ {
+ var namespaces = functionName.split('.');
+ var scope = window;
+ while(namespaces.length)
+ {
+ scope = scope[namespaces.shift()];
+ }
+ fn = scope;
+ }
+ else
+ fn = window[functionName] || options.customFunctions[functionName];
if (typeof(fn) == 'function')
return fn(field, rules, i, options);

0 comments on commit f5e2d41

Please sign in to comment.