aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--templates/web/base/report/update/form_name.html2
-rw-r--r--web/cobrands/fixmystreet-uk-councils/js.js9
-rw-r--r--web/cobrands/fixmystreet.com/js.js11
3 files changed, 17 insertions, 5 deletions
diff --git a/templates/web/base/report/update/form_name.html b/templates/web/base/report/update/form_name.html
index 19c31998e..33887117a 100644
--- a/templates/web/base/report/update/form_name.html
+++ b/templates/web/base/report/update/form_name.html
@@ -25,7 +25,7 @@
<p class='form-error'>[% field_errors.name %]</p>
[% END %]
-<input type="text" class="form-control validName js-form-name"
+<input type="text" class="form-control validNameU js-form-name"
name="name" id="form_name" value="[% update.name || c.user.name | html %]" placeholder="[% loc('Your name') %]">
<div class="checkbox-group">
diff --git a/web/cobrands/fixmystreet-uk-councils/js.js b/web/cobrands/fixmystreet-uk-councils/js.js
index 3abba8e33..6066db9c5 100644
--- a/web/cobrands/fixmystreet-uk-councils/js.js
+++ b/web/cobrands/fixmystreet-uk-councils/js.js
@@ -1,3 +1,8 @@
-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(value, element) {
+ return this.optional(element) || value.length > 5 && value.match( /\S/ ) && value.match( /\s/ ) && !value.match( validNamePat );
+ }
+ jQuery.validator.addMethod('validName', valid_name, translation_strings.name.required);
+ jQuery.validator.addMethod('validNameU', valid_name, translation_strings.name.required);
+})();
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(){