Google Autocomplete JS

This topic contains 5 replies, has 2 voices, and was last updated by  Y A 9 years, 9 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #34857

    Y A
    Expired Member
    Post count: 156

    Hi !
    I’m looking to add an event listener to the Google Autocomplete form in the Add Listing page.

    google.maps.event.addListener(autocomplete, .., ..);

    Could someone please help me find the file where the this code is hiding?

    #34958

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    Hello,

    I’m not sure what you are trying to do, if you explain better i might be able to help more, the code your looking for is here: https://github.com/GeoDirectory/geodirectory/blob/master/geodirectory-functions/map-functions/map_template_tags.php#L219

    Thanks,

    Stiofan

    #34971

    Y A
    Expired Member
    Post count: 156

    Hi Stiofan,

    I’m trying to get rid of the “Title” input field from the front-end, and have the Address automatically copy itself into the hidden field (display:none).

    I have tried using the following code:

    
    
    jQuery(document).ready(function($){
        $("#post_address").on('input change paste keyup',function(){
        $("#post_title").val($(this).val());
        });
    });

    It works, but it is not sufficient. For example, nothing happens when users click an address from the dropdown list suggested by the Autocomplete form.

    I am therefore trying to add the following listener to have a comprehensive system.

    
    
    google.maps.event.addListener(autocomplete, 'place_changed', function() {
        $("#post_title").val($("#post_address").val());
    });
    #34985

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    i would have thought that would work, maybe just add a onclick event to the autocomplete div also?

    Stiofan

    #35061

    Y A
    Expired Member
    Post count: 156

    Unfortunately, that doesn’t work either. I think we need a way to add a onclick event to the list of suggestions… but I can’t find the element ID of the suggestion box.

    See the attached file; If someone clicks on the red marker, it falls outside of the autocomplete div

    #35414

    Y A
    Expired Member
    Post count: 156

    Hey Stiofan,

    Correct me if I’m wrong, but I think the code you showed me is the one used for the Map tab on the details page (where directions are given).

    Is there a separate code that calls for the autocomplete form on the Add Listing page?

Viewing 6 posts - 1 through 6 (of 6 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
20% Discount Offer
Hurry! Get your 20% discount before it expires. Get 20% Discount