From: Frédéric Buclin Date: Mon, 19 Oct 2015 16:16:28 +0000 (+0200) Subject: Bug 1210078: Going back from the "Match failed" page deletes the values of user fields X-Git-Tag: release-5.1.1~155 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c4c72526cff7f6c2dcd93156d73dd330bcb9e0e1;p=thirdparty%2Fbugzilla.git Bug 1210078: Going back from the "Match failed" page deletes the values of user fields r=gerv --- diff --git a/js/field.js b/js/field.js index 2bd8868f82..063d48c476 100644 --- a/js/field.js +++ b/js/field.js @@ -794,6 +794,7 @@ $(function() { else { that.devbridgeAutocomplete(options_user); } + that.addClass('bz_autocomplete'); }); // init autocomplete fields with array of values @@ -809,6 +810,7 @@ $(function() { this.focus(); } }); + that.addClass('bz_autocomplete'); }); }); diff --git a/js/global.js b/js/global.js index b4905e202b..dcffc35290 100644 --- a/js/global.js +++ b/js/global.js @@ -51,3 +51,15 @@ function display_value(field, value) { if (translated) return translated; return value; } + +// jQuery auto-completion disables browser native autocompletion, however this +// excludes it from being restored by bfcache. Trick the browser into restoring +// it by changing the autocomplete attribute when a page is hidden and shown. +$().ready(function() { + $(window).on('pagehide', function() { + $('.bz_autocomplete').attr('autocomplete', 'on'); + }); + $(window).on('pageshow', function() { + $('.bz_autocomplete').attr('autocomplete', 'off'); + }); +});