0

I am not able to view the map on the Custom object detail page. I am able to save the page, and also I am not getting any errors, but still unable to view anything Please help me with the possible errors.

<apex:page standardController="Library_Management_System__c">
<head>
    <script type="text/javascript" src="https://maps.google.com/maps/api/js?sensor=false"></script>
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
    <script type="text/javascript">

        $(document).ready(function() {
            varmyOptions = {
                zoom: 15,
                mapTypeId: google.maps.MapTypeId.ROADMAP,
                mapTypeControl: false
            }
            var map;
            var marker;

            vargeocoder = new google.maps.Geocoder();
            var address = “{!Library_Management_System__c.Address__c}";

            varinfowindow = new google.maps.InfoWindow({
                content: “<b>{!Library_Management_System__c.Author__c}"
            });

        geocoder.geocode( { address: address}, function(results, status) {
            if (status == google.maps.GeocoderStatus.OK&&results.length) {
                if (status != google.maps.GeocoderStatus.ZERO_RESULTS) {

                    //create map
                    map = new google.maps.Map(document.getElementById(“map"), myOptions);

                    //center map
                    map.setCenter(results[0].geometry.location);

                    //create marker
                    marker = new google.maps.Marker({
                        position: results[0].geometry.location,
                        map: map,
                        title: “{!Library_Management_System__c.Author__c}"
                    });

                    //add listeners
                    google.maps.event.addListener(marker, 'click', function() {
                        infowindow.open(map,marker);
                    });
                    google.maps.event.addListener(infowindow, 'closeclick', function() {
                        map.setCenter(marker.getPosition());
                    });
                }
            } else {
              $('#map').css({'height' : '15px'});
              $('#map').html(“Oops! {!Library_Management_System__c.Author__c}'s billing address could not be found, please make sure the address is correct.");
              resizeIframe();
          }
      });

functionresizeIframe() {
    var me = window.name;
    if (me) {
        variframes = parent.document.getElementsByName(me);
        if (iframes&&iframes.length == 1) {
            height = document.body.offsetHeight;
            iframes[0].style.height = height + “px";
        }
    }
}
});
</script>

<style>
    #map {
        font-family: Arial;
        font-size:12px;
        line-height:normal !important;
        height:250px;
        background:transparent;
    }
</style>
</head>
<body>
    <div id="map"></div>
</body>
</apex:page>
3
  • 1
    This is not in any way Salesforce specific. Please ask this question on Stack Overflow instead.
    – Adrian Larson
    Commented May 21, 2015 at 18:22
  • 1
    @happy, its also not considered acceptable behavior here to repeatedly post, delete and then repost the same question.
    – crmprogdev
    Commented May 21, 2015 at 19:09
  • Actually the previous one was completely different altogether.
    – happy
    Commented May 21, 2015 at 19:37

1 Answer 1

1

There are a lot of wrong JS things in your VF page and I cannot write code for you however take a look at this post there is the same code you want to implement in your VF page.

Hope this will help you.

1
  • If my answer helped you please mark it as the solution. Thanks! Commented May 21, 2015 at 18:45

Not the answer you're looking for? Browse other questions tagged .