[freeside-commits] branch FREESIDE_3_BRANCH updated. 5a6c740c8152b1e8fa61d449808a50cdd7de07ab

Mark Wells mark at 420.am
Thu Aug 8 17:00:54 PDT 2013


The branch, FREESIDE_3_BRANCH has been updated
       via  5a6c740c8152b1e8fa61d449808a50cdd7de07ab (commit)
      from  5c814b79aafba1467b2e8dfa9b1def41331841ed (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 5a6c740c8152b1e8fa61d449808a50cdd7de07ab
Author: Mark Wells <mark at freeside.biz>
Date:   Thu Aug 8 17:00:06 2013 -0700

    clear coordinate fields when editing addresses, #24210

diff --git a/httemplate/elements/location.html b/httemplate/elements/location.html
index 41a67a0..df5106c 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 = @_;

-----------------------------------------------------------------------

Summary of changes:
 httemplate/elements/location.html |   36 ++++++++++++++++++++++++++++++++++++
 1 files changed, 36 insertions(+), 0 deletions(-)




More information about the freeside-commits mailing list