Google map icon using list data

Forums Requests Google map icon using list data

This topic contains 1 reply, has 2 voices, and was last updated by  Alexander Bautz 9 months, 1 week ago.

  • Author
    Posts
  • #20086

    Nichols Family
    Participant

    I want to be to display a google map with a icon based on the list field “posn” do you have any solutions for this? Thanks for your help.

  • #20166

    Alexander Bautz
    Keymaster

    If you mean a link in a form (like DispForm) to open maps.google.com you can use a few lines of custom code like this.

    Add this HTML to a HTML section in a tab:

    <div id="mapsLinkPlaceholder"></div>

    Then add this to your Custom JS:

    function getMapsLink(){
        var b = [], lat = getFieldValue("Lat"), long = getFieldValue("Long");
        b.push("<a href='http://www.google.com/maps/place/"+lat+","+long+"' target='_blank'>");
        b.push("<img src='https://www.gstatic.com/images/branding/product/1x/maps_64dp.png'>");
        b.push("</a>");
        jQuery("#mapsLinkPlaceholder").html(b.join(""));
    }
    // Call directly, or from a rule
    getMapsLink();

    Change the field names “Lat” and “Long” to match your field names.

    Alexander

You must be logged in to reply to this topic.