From 0d64a7883444e760768c407af4db1606dfc67a85 Mon Sep 17 00:00:00 2001 From: Chang Shu-Huai Date: Wed, 27 Nov 2024 18:23:30 +0800 Subject: [PATCH] Refs #41821,Enhance location form to fill city and postal code on Ajax trigger. --- templates/CRM/Event/Form/ManageEvent/Location.tpl | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/templates/CRM/Event/Form/ManageEvent/Location.tpl b/templates/CRM/Event/Form/ManageEvent/Location.tpl index d0cfa4472..e6bf885e4 100644 --- a/templates/CRM/Event/Form/ManageEvent/Location.tpl +++ b/templates/CRM/Event/Form/ManageEvent/Location.tpl @@ -137,6 +137,14 @@ cj(document).ready(function() { cj('#'+i).val(data[i]); } } + if (typeof jQuery === 'function' && typeof jQuery.prototype.twzipcode === 'function') { + let $ = jQuery; + let city = $('#address_1_city').val(); + let zipcode = $('#address_1_postal_code').val(); + $('#address_1_state_province_id').trigger('change'); + $('[name="_address[1][city]"]').val(city).trigger('change'); + $('#address_1_postal_code').val(zipcode); + } } }); return false;