|
@ -57,6 +57,7 @@ $.fn.form = function(parameters) { |
|
|
metadata, |
|
|
metadata, |
|
|
selector, |
|
|
selector, |
|
|
className, |
|
|
className, |
|
|
|
|
|
regExp, |
|
|
error, |
|
|
error, |
|
|
|
|
|
|
|
|
namespace, |
|
|
namespace, |
|
@ -262,6 +263,12 @@ $.fn.form = function(parameters) { |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
return allValid; |
|
|
return allValid; |
|
|
|
|
|
}, |
|
|
|
|
|
validHTMLID(value) { |
|
|
|
|
|
if(typeof value !== 'string') { |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
return value.search(regExp.htmlID) !== -1; |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
@ -465,6 +472,7 @@ $.fn.form = function(parameters) { |
|
|
metadata = settings.metadata; |
|
|
metadata = settings.metadata; |
|
|
selector = settings.selector; |
|
|
selector = settings.selector; |
|
|
className = settings.className; |
|
|
className = settings.className; |
|
|
|
|
|
regExp = settings.regExp; |
|
|
error = settings.error; |
|
|
error = settings.error; |
|
|
moduleNamespace = 'module-' + namespace; |
|
|
moduleNamespace = 'module-' + namespace; |
|
|
eventNamespace = '.' + namespace; |
|
|
eventNamespace = '.' + namespace; |
|
@ -477,7 +485,7 @@ $.fn.form = function(parameters) { |
|
|
}, |
|
|
}, |
|
|
field: function(identifier) { |
|
|
field: function(identifier) { |
|
|
module.verbose('Finding field with identifier', identifier); |
|
|
module.verbose('Finding field with identifier', identifier); |
|
|
if( $field.filter('#' + identifier).length > 0 ) { |
|
|
|
|
|
|
|
|
if(module.is.validHTMLID(identifier) && $field.filter('#' + identifier).length > 0 ) { |
|
|
return $field.filter('#' + identifier); |
|
|
return $field.filter('#' + identifier); |
|
|
} |
|
|
} |
|
|
else if( $field.filter('[name="' + identifier +'"]').length > 0 ) { |
|
|
else if( $field.filter('[name="' + identifier +'"]').length > 0 ) { |
|
@ -595,7 +603,7 @@ $.fn.form = function(parameters) { |
|
|
if(typeof identifier !== 'string') { |
|
|
if(typeof identifier !== 'string') { |
|
|
module.error(error.identifier, identifier); |
|
|
module.error(error.identifier, identifier); |
|
|
} |
|
|
} |
|
|
if( $field.filter('#' + identifier).length > 0 ) { |
|
|
|
|
|
|
|
|
if(module.is.validHTMLID(identifier) && $field.filter('#' + identifier).length > 0 ) { |
|
|
return true; |
|
|
return true; |
|
|
} |
|
|
} |
|
|
else if( $field.filter('[name="' + identifier +'"]').length > 0 ) { |
|
|
else if( $field.filter('[name="' + identifier +'"]').length > 0 ) { |
|
@ -1090,6 +1098,7 @@ $.fn.form.settings = { |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
regExp: { |
|
|
regExp: { |
|
|
|
|
|
htmlID : /^[a-zA-Z][\w:.-]*$/g, |
|
|
bracket : /\[(.*)\]/i, |
|
|
bracket : /\[(.*)\]/i, |
|
|
decimal : /^\d+\.?\d*$/, |
|
|
decimal : /^\d+\.?\d*$/, |
|
|
email : /^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i, |
|
|
email : /^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i, |
|
|