From 179022b129e0c4c526b47e28ebde8e779c82541d Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sat, 23 Apr 2016 16:49:43 +0200 Subject: [PATCH] Fix country and state were not properly updated after ziptown selection --- htdocs/core/lib/ajax.lib.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index 4b3ab3b32f4..fc27f665e45 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -290,14 +290,15 @@ function ajax_multiautocompleter($htmlname, $fields, $url, $option='', $minLengt needtotrigger="#" + fields[i]; } } - } - if (needtotrigger != "") // To force select2 to refresh visible content - { - // We introduce a delay so hand is back to js and all other js change can be done before the trigger that may execute a submit is done - // This is required for example when changing zip with autocomplete that change the country - jQuery(needtotrigger).delay(500).queue(function() { - jQuery(needtotrigger).trigger("change"); - }); + + if (needtotrigger != "") // To force select2 to refresh visible content + { + // We introduce a delay so hand is back to js and all other js change can be done before the trigger that may execute a submit is done + // This is required for example when changing zip with autocomplete that change the country + jQuery(needtotrigger).delay(500).queue(function() { + jQuery(this).trigger("change"); + }); + } } } });