From e211009eb7f2c595fcc0b64a4f60e2bd08f13303 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Wed, 2 Jan 2013 22:05:14 +0100 Subject: [ticket/11302] Correctly select first timezone or selected timezone While registering, we should default to a given timezone. By selecting the first timezone by default, this is fulfilled. This doesn't happen currently, as only the "Select a timezone" selection appears. If a user selects a timezone during the registration process we should also make sure that the selected element is still selected; even if we have to return to the registration page, i.e. if there was an error while submitting the form. This is currently not the case. With this patch the javascript code will behave correctly. Additionally, a duplicate inclusion of timezone.js has been removed as it was not needed. PHPBB3-11302 --- phpBB/assets/javascript/core.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'phpBB/assets') diff --git a/phpBB/assets/javascript/core.js b/phpBB/assets/javascript/core.js index c18bec7035..a4f7455b01 100644 --- a/phpBB/assets/javascript/core.js +++ b/phpBB/assets/javascript/core.js @@ -438,7 +438,10 @@ phpbb.timezone_switch_date = function(keep_selection) { } if (typeof keep_selection !== 'undefined' && !keep_selection) { - $('#timezone > option:first').attr('selected', true); + var timezoneOptions = $('#timezone > optgroup option'); + if (timezoneOptions.filter(':selected').length <= 0) { + timezoneOptions.filter(':first').attr('selected', true); + } } } -- cgit v1.2.1