aboutsummaryrefslogtreecommitdiffstats
path: root/web/js
diff options
context:
space:
mode:
authorHakim Cassimally <hakim@mysociety.org>2014-11-13 18:13:19 +0000
committerMatthew Somerville <matthew@mysociety.org>2014-11-14 18:23:37 +0000
commit7826ff359728e7033012d501c02763f26786ce28 (patch)
treecede64a4ac24d2e74d1705bb90fbfba3d8ccfca7 /web/js
parent62e37f1d8d57ee8eebf6e8ecc388aeef23493e5d (diff)
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.
Diffstat (limited to 'web/js')
-rw-r--r--web/js/fixmystreet.js4
1 files changed, 4 insertions, 0 deletions
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);