Add javascript to handle input of a pair of geo coordinates and move longitude to second field

This commit is contained in:
ruben 2014-07-21 21:39:51 +02:00
parent 05bc59f319
commit 2df9903938
1 changed files with 12 additions and 1 deletions

View File

@ -62,7 +62,18 @@
<%- if not self.cancel then -%><%-:Cancel-%><%-else-%><%=self.cancel%><%end-%>
" />
<% end %>
<script type="text/javascript">cbi_d_update();</script>
<script type="text/javascript">
cbi_d_update();
window.onload = function() {
var spread_latitude = document.getElementById('cbid.wizard.1._latitude');
var spread_longitude = document.getElementById('cbid.wizard.1._longitude');
spread_latitude.addEventListener('change', function() {
p=spread_latitude.value.trim().split(/[ ,]+/);
spread_latitude.value = p[0];
spread_longitude.value = p[1];
});
}
</script>
</div>
</form>
<% end %>