From cf042b5e5590f63e3ef81c78f59c66ca6e7aec76 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Fri, 12 May 2017 09:38:37 -0400 Subject: [PATCH] Bug 18569 - Quick add patron will not copy over details from cities and towns pull down into patron details As the quick add form is created dynamically we must alter the function that updates there fields to use a selector so it is not bound on the intial elements To test: 1 - Add city field to QuickAddFields 2 - Define some cities in Admin->Cities and towns 3 - Test using the dropdown in uqick add form 4 - Nothing happens 5 - Switch to full form 6 - use cities dropdown 7 - it works 8 - switch to quick add form 9 - dropdown is not updated 10 - Apply patch 11 - Things should now update correctly on both forms and update when switching forms --- koha-tmpl/intranet-tmpl/prog/js/members.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/members.js b/koha-tmpl/intranet-tmpl/prog/js/members.js index 3ea7868..28853b2 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/members.js +++ b/koha-tmpl/intranet-tmpl/prog/js/members.js @@ -307,13 +307,14 @@ $(document).ready(function(){ $("#quick_add_form #guarantorsearch, #guarantorsearch").val(LABEL_SET_TO_PATRON); }); - $("#select_city").change(function(){ + $(document.body).on('change','select[name="select_city"]',function(){ + $('select[name="select_city"]').val( $(this).val() ); var myRegEx=new RegExp(/(.*)\|(.*)\|(.*)\|(.*)/); - document.form.select_city.value.match(myRegEx); - document.form.zipcode.value=RegExp.$1; - document.form.city.value=RegExp.$2; - document.form.state.value=RegExp.$3; - document.form.country.value=RegExp.$4; + $(this).val().match(myRegEx); + $('input[name="zipcode"]').val( RegExp.$1 ); + $('input[name="city"]').val( RegExp.$2 ); + $('input[name="state"]').val( RegExp.$3 ); + $('input[name="country"]').val( RegExp.$4 ); }); $("#dateofbirth").datepicker({ maxDate: "-1D", yearRange: "c-120:" }); -- 2.1.4