1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Problem With Places Autocomlete

Discussion in 'Google API' started by Carlos Gomes Ferreira, Jan 30, 2013.

  1. #1
    Hi,
    I have a web form in which I have a textbox attached to a google places autocomplete. This works fine. What I want to do is save the value that the autocomplete stores in the textbox to a BD, and later on be able to show the form filled with the values stored in the BD.

    try {
    acOrigem = new google.maps.places.Autocomplete($("#txtAdressORI")[0], {});
    google.maps.event.addListener(acOrigem, 'place_changed', function () { CreateMap(); });
    :
    function CreateMap() {
    var placeORI = acOrigem.getPlace();
    :

    This works fine. The issue is that when I do:

    document.getElementById("txtAdressORI").value = "Lisboa,Portugal"; <- this is a correct place that was previously returned on screen by the autocomlete.
    google.maps.event.trigger(acOrigem, 'place_changed');

    The function is triggered correctly but the place is not recognized(i.e. getPlace() returns Null).
    Does anyone have any Idea on how to achieve this?
    Thanks
     
    Carlos Gomes Ferreira, Jan 30, 2013 IP