The order in which the library calls updateInputValues and the user-specified onchanged handler is inconsistent. When using autocomplete it is in the following order:
updateInputValues(inputBinding, context);context.settings.onchanged.apply(gmapContext.domContainer, ...
This allows for the onchanged function to overwrite the value automatically set in the locationName field by updateInputValues (which is useful if you don't want the default formatted address string that updateInputValues inserts).
However in the event handler for dragend, it is done the other way
updateInputValues(gmapContext.settings.inputBinding, gmapContext);context.settings.onchanged.apply(gmapContext.domContainer, ...
which nullifies any changes the user makes to the locationName input in the onchanged handler.
Patch:
From 0198c6b2fdb9c838a33812030a4e0dfa3041eb7e Mon Sep 17 00:00:00 2001
From: wspencer <warren.spencer@pason.com>
Date: Thu, 23 Jun 2016 09:31:44 -0600
Subject: [PATCH 1/1] locationpicker: Standardizes the order of the onchanged
function call in relation to updateInputValues.
---
src/locationpicker.jquery.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/locationpicker.jquery.js b/src/locationpicker.jquery.js
index 81a2c50..f1e3a95 100644
--- a/src/locationpicker.jquery.js
+++ b/src/locationpicker.jquery.js
@@ -372,8 +372,8 @@
google.maps.event.addListener(gmapContext.marker, "dragend", function(event) {
GmUtility.setPosition(gmapContext, gmapContext.marker.position, function(context){
var currentLocation = GmUtility.locationFromLatLng(gmapContext.location);
- context.settings.onchanged.apply(gmapContext.domContainer, [currentLocation, context.radius, true]);
updateInputValues(gmapContext.settings.inputBinding, gmapContext);
+ context.settings.onchanged.apply(gmapContext.domContainer, [currentLocation, context.radius, true]);
});
});
GmUtility.setPosition(gmapContext, new google.maps.LatLng(settings.location.latitude, settings.location.longitude), function(context){
--
1.9.1
The order in which the library calls updateInputValues and the user-specified onchanged handler is inconsistent. When using autocomplete it is in the following order:
updateInputValues(inputBinding, context);
context.settings.onchanged.apply(gmapContext.domContainer, ...
This allows for the onchanged function to overwrite the value automatically set in the locationName field by updateInputValues (which is useful if you don't want the default formatted address string that updateInputValues inserts).
However in the event handler for dragend, it is done the other way
updateInputValues(gmapContext.settings.inputBinding, gmapContext);
context.settings.onchanged.apply(gmapContext.domContainer, ...
which nullifies any changes the user makes to the locationName input in the onchanged handler.
Patch: