Autocomplete issue

Support MB Geolocation Autocomplete issue

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #3138
    SinusiteSinusite
    Participant

    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 🙂

    #3143
    Anh TranAnh Tran
    Keymaster

    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.

    #3203
    SinusiteSinusite
    Participant

    No i'm not using a password field. - may be the nonce of ajax in page ? I will check that later...

    #3313
    SinusiteSinusite
    Participant

    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

    #3314
    SinusiteSinusite
    Participant

    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.

    #3365
    Tan NguyenTan Nguyen
    Participant

    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 MB 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

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Autocomplete issue’ is closed to new replies.