summaryrefslogtreecommitdiff
path: root/httemplate/elements/location.html
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2013-08-08 16:59:56 -0700
committerMark Wells <mark@freeside.biz>2013-08-08 16:59:56 -0700
commit43c8e76ef8fa89a6a082ccc045d1101c44122539 (patch)
tree100f5a734d22afe418ebd8b9f1b558066e64b9cc /httemplate/elements/location.html
parentc23753d010e11b83ed19e0f3347adc7161ce7de9 (diff)
clear coordinate fields when editing addresses, #24210
Diffstat (limited to 'httemplate/elements/location.html')
-rw-r--r--httemplate/elements/location.html36
1 files changed, 36 insertions, 0 deletions
diff --git a/httemplate/elements/location.html b/httemplate/elements/location.html
index 41a67a0cb..df5106cb0 100644
--- a/httemplate/elements/location.html
+++ b/httemplate/elements/location.html
@@ -244,6 +244,42 @@ Example:
%# Placeholders
<INPUT TYPE="hidden" NAME="<%$pre%>cachenum" VALUE="">
<INPUT TYPE="hidden" NAME="<%$pre%>addr_clean" VALUE="">
+
+<SCRIPT TYPE="text/javascript">
+// the strictly correct way to append something to window.onload
+window.addEventListener('load', function() {
+ var clear_coords_ids = [
+ '<%$pre%>latitude',
+ '<%$pre%>longitude',
+ 'enter_censustract',
+ '<%$pre%>district'
+ ];
+ function clear_coords() {
+ for (var i=0; i < clear_coords_ids.length; i++) {
+ var el = document.getElementById(clear_coords_ids[i]);
+ if ( el ) {
+ el.value = '';
+ }
+ }
+ }
+ var clear_coords_on_change = [
+ '<%$pre%>address1',
+ '<%$pre%>address2',
+ '<%$pre%>city',
+ '<%$pre%>state',
+ '<%$pre%>zip',
+ '<%$pre%>country',
+ ];
+ for (var i=0; i < clear_coords_on_change.length; i++) {
+ var el = document.getElementById(clear_coords_on_change[i]);
+ if ( el ) {
+ // because some of these already have onchange triggers
+ el.addEventListener('change', clear_coords);
+ }
+ }
+});
+</SCRIPT>
+
<%init>
my %opt = @_;