diff options
author | Matthew Somerville <matthew@mysociety.org> | 2019-11-29 11:18:33 +0000 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2019-11-29 11:18:33 +0000 |
commit | 8b03c93d0befaac84a588aa4bb03309d1c1a30c6 (patch) | |
tree | f37fb1d82361f4acfd3e4f0dfe80b2fab6f063b8 /web/cobrands/fixamingata/js.js | |
parent | c2d05c13048a89f930f76ba7d9314235d5face19 (diff) | |
parent | aff43d78c55ce7a659f8e7d0bf28bf483fa33a7b (diff) |
Merge branch 'mysociety-delivery' of git://github.com/Sambruk/fixmystreet
Diffstat (limited to 'web/cobrands/fixamingata/js.js')
-rw-r--r-- | web/cobrands/fixamingata/js.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/web/cobrands/fixamingata/js.js b/web/cobrands/fixamingata/js.js index ca5f772c4..94fa2034e 100644 --- a/web/cobrands/fixamingata/js.js +++ b/web/cobrands/fixamingata/js.js @@ -1 +1,20 @@ fixmystreet.inspect_form_no_scroll_on_load = 1; + +// Chrome ignores autocomplete="off" on the title input, +// and incorrectly autocompletes it with the user's email address. +// For now we'll reset the title to empty if it contains +// an email address when the user has selected a category. +// Hopefully we can get rid of this eventually if Chrome changes +// its behaviour. +fixmystreet.fixChromeAutocomplete = function() { + var title = document.getElementById("form_title"); + + if (title) { + if (title.value == "" || + /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@(?:\S{1,63})$/.test(title.value)) { + title.value = ""; + } + } +}; + +$(fixmystreet).on('report_new:category_change', fixmystreet.fixChromeAutocomplete); |