From c9a747dac5e87f67258a3990fe40abfa7e267a1c Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Thu, 21 Jan 2021 04:05:51 +0000 Subject: [PATCH] Bug 26436: fix city/town pulldown This patch uses a different selector to target the inputs. 1. add some cities to /cgi-bin/koha/admin/cities.pl with city, state, zipcode, and country defined 2. On PatronQuickAddFields select all, this way we can test all the alternate city selects 3. Go to quick add patron, and select a city from the dropdown, the city/state/zip/country doesn't populate (Alternate address city doesnt work either) 4. Apply patch 5. Do 1 - 3 again, it should work 6. Try the regular patron form, make sure all city/town dropdowns still work --- koha-tmpl/intranet-tmpl/prog/js/members.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/members.js b/koha-tmpl/intranet-tmpl/prog/js/members.js index f38870cc48..cd3c08bf9c 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/members.js +++ b/koha-tmpl/intranet-tmpl/prog/js/members.js @@ -203,16 +203,15 @@ $(document).ready(function(){ e.preventDefault(); $(this).parents('fieldset').first().remove(); }); - $(document.body).on('change','.select_city',function(){ var selected_city = $(this).val(); var addressfield = $(this).data("addressfield"); var myRegEx=new RegExp(/(.*)\|(.*)\|(.*)\|(.*)/); var matches = selected_city.match( myRegEx ); - $("#" + addressfield + "zipcode").val( matches[1] ); - $("#" + addressfield + "city").val( matches[2] ); - $("#" + addressfield + "state").val( matches[3] ); - $("#" + addressfield + "country").val( matches[4] ); + $('input[name="' + addressfield + "zipcode").val( matches[1] ); + $('input[name="' + addressfield + "city").val( matches[2] ); + $('input[name="' + addressfield + "state").val( matches[3] ); + $('input[name="' + addressfield + "country").val( matches[4] ); }); dateformat = $("#dateofbirth").siblings(".hint").first().html(); -- 2.11.0