From 7826ff359728e7033012d501c02763f26786ce28 Mon Sep 17 00:00:00 2001 From: Hakim Cassimally Date: Thu, 13 Nov 2014 18:13:19 +0000 Subject: Fix JS-disabled submission in Chrome/Firefox. Fixes #932, which is caused by HTML5 validation firing for hidden elements, by setting #mapForm to novalidate by default, and reverting this in fixmystreet.js. Note that the 'novalidate' attribute, which is honoured by the browsers' HTML5 validation, isn't to be confused with the class (class="validate") which is picked up by fixmystreet.js, and therefore not problematic for the no-js case. --- templates/web/base/around/display_location.html | 2 +- templates/web/seesomething/around/display_location.html | 2 +- web/js/fixmystreet.js | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/templates/web/base/around/display_location.html b/templates/web/base/around/display_location.html index 182c1249e..dbe7d9ffd 100755 --- a/templates/web/base/around/display_location.html +++ b/templates/web/base/around/display_location.html @@ -39,7 +39,7 @@ %] [% IF allow_creation %] -
+ [% IF c.req.params.map_override %] [% END %] diff --git a/templates/web/seesomething/around/display_location.html b/templates/web/seesomething/around/display_location.html index e90d1aa0e..ea0a499f7 100644 --- a/templates/web/seesomething/around/display_location.html +++ b/templates/web/seesomething/around/display_location.html @@ -19,7 +19,7 @@ %] - + [% IF c.req.params.map_override %] [% END %] diff --git a/web/js/fixmystreet.js b/web/js/fixmystreet.js index 7d75c8b65..c8f1fe697 100644 --- a/web/js/fixmystreet.js +++ b/web/js/fixmystreet.js @@ -203,6 +203,10 @@ $(function(){ }); }); + // Map form doesn't work in some browsers with HTML5 validation and hidden form, so + // we disable validation by default, and add it in the JS case. + // For some reason, the removeAttr doesn't work if we place it at beginning. + $('#mapForm').removeAttr('novalidate'); }); })(jQuery); -- cgit v1.2.3