Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fixing the map geolocation when having a list of text fields as address_field #247

Merged
merged 1 commit into from

2 participants

@jberdah

Hi, I was facing an issue trying to have more than one text field as "address_field" array value for a map meta box, for example:
array(
'id' => 'loc',
'name' => 'Location',
'type' => 'map',
'std' => '-6.233406,-35.049906,15',
'style' => 'width: 500px; height: 500px',
'address_field' => 'street_address,postal_code,city,country',

The address sent to google maps was missing a separator between the text fields values.
Also no spaces should be used between the field names, it would generate an error.
I hope this helps.

Thanks a lot for your work!

@jberdah jberdah Update map.js
Fixed the multiple fields entries to map field
05f7526
@rilwis rilwis merged commit b5ac988 into rilwis:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 14, 2013
  1. @jberdah

    Update map.js

    jberdah authored
    Fixed the multiple fields entries to map field
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  js/map.js
View
2  js/map.js
@@ -1,4 +1,3 @@
-
var marker, map, geocoder;
jQuery( document ).ready( function ()
@@ -65,6 +64,7 @@ jQuery( document ).ready( function ()
for ( loop = 0; loop < fieldList.length; loop++ )
{
address += jQuery( '#' + fieldList[loop] ).val();
+ if(loop+1 < fieldList.length) { address += ', '; }
}
address = address.replace( /\n/g, ',' );
Something went wrong with that request. Please try again.