aboutsummaryrefslogtreecommitdiffstats
path: root/web/cobrands/fixmystreet.com/js.js
diff options
context:
space:
mode:
Diffstat (limited to 'web/cobrands/fixmystreet.com/js.js')
-rw-r--r--web/cobrands/fixmystreet.com/js.js11
1 files changed, 9 insertions, 2 deletions
diff --git a/web/cobrands/fixmystreet.com/js.js b/web/cobrands/fixmystreet.com/js.js
index 68651e120..b38df87ed 100644
--- a/web/cobrands/fixmystreet.com/js.js
+++ b/web/cobrands/fixmystreet.com/js.js
@@ -1,6 +1,13 @@
-jQuery.validator.addMethod('validName', function(value, element) {
+(function(){
var validNamePat = /\ba\s*n+on+((y|o)mo?u?s)?(ly)?\b/i;
- return this.optional(element) || value.length > 5 && value.match( /\S/ ) && value.match( /\s/ ) && !value.match( validNamePat ); }, translation_strings.category );
+ function valid_name_factory(single) {
+ return function(value, element) {
+ return this.optional(element) || value.length > 5 && value.match(/\S/) && (value.match(/\s/) || (single && !value.match('.@.'))) && !value.match(validNamePat);
+ };
+ }
+ jQuery.validator.addMethod('validName', valid_name_factory(0), translation_strings.name.required);
+ jQuery.validator.addMethod('validNameU', valid_name_factory(1), translation_strings.name.required);
+})();
$(function(){