Support Forum
Support › Meta Box Geolocation › Autocomplete issue
after https://support.metabox.io/topic/auto-complete-and-map-field-conflicts/
two curious things ;
1 - uncomment include MBG_DIR . 'examples/example.php'; don't work with a new post :
mb-geo.js?ver=1.0.0:89 Uncaught TypeError: Cannot read property 'Autocomplete' of undefined
2 - i have a more complex CPT with hidden text fields. When i use autocomplete, it works, but the text fields (for the same metabox) are filled by somthing like 86209711dc1123d3052690626e21a5a52e08c82e
Thanks 🙂
Hi @Sinusite,
@Tan Nguyen will answer you the 1st question :). Regarding the 2nd question: are you using password field? We received a request from a user asking for hashing the password and not showing plain password in a hidden field to make it secured. For more info about the hashing function, please read this documentation at the Codex.
No i'm not using a password field. - may be the nonce of ajax in page ? I will check that later...
Hi,
Found an issue, may be it is only in my context...
I put a meta-box with "geo" in two custom post types.
$meta_boxes['projet'] = array(
'title' => 'Projet',
'id' => 'box_projet',
'pages' => array( 'bbv_conseil', 'bbv_projet' ),
'context' => 'normal',
'priority' => 'low',
'autosave' => false,
'geo' => array(
'types' => array('establishment','geocode'),
'componentRestrictions' => array(
'country' => 'fr'
)
),
It's working for the 1st, not the second post type ( same with geo => true ...) :
mb-geo.js?ver=1.0.0:89 Uncaught TypeError: Cannot read property 'Autocomplete' of undefined
After reading that, i added in map.php line 18
https://maps.google.com/maps/api/js<strong>?libraries=places</strong>
and it works.
It seems
<script type='text/javascript' src='https://maps.googleapis.com/maps/api/js?libraries=places&ver=4.2.2'></script>
is not included in the second post type
nota : ?sensor=false is useless
mmm... i tried with the Geoloc example instead of my cpt :
if $meta_boxes['mine'] is called with AND before $meta_boxes['with_geo'], it works....
( $meta_boxes['1'] can contain only 1 text field )
i also put the demo (adress and map fields) in $meta_boxes['1'] and it seems not working if there only one metabox.
Hi Sinusite,
Perhaps in your context, the maps field's script in loaded before Geolocation. To fix that, go to inc/class-meta-box-geolocation.php
and replace:
add_action('rwmb_enqueue_scripts', array($this, 'enqueue'));
with:
add_action('admin_enqueue_scripts', array($this, 'enqueue'));
to make sure Meta Box Geolocation loaded first.
Let me know if it works so I'll put the patch to the next release 🙂
Also, I don't understand this:
if $meta_boxes[‘mine’] is called with AND before $meta_boxes[‘with_geo’], it works….
( $meta_boxes[‘1’] can contain only 1 text field )i also put the demo (adress and map fields) in $meta_boxes[‘1’] and it seems not working if there only one metabox.
Best regards,
Tan