I want to be able to capture the location when the user clicks on the window.

I just need to store the coordinates, then I can display a map marker.

VisualForce Map Code:

<apex:map height="500px" width="100%" mapType="roadmap" center="London" />

From what I have researched so far, is I would need to use JavaScript to interact with the Map itself, then pass the coordinates to the controller.

  • what kind of window ? coordinate of current user location ? – Ankuli Aug 24 '16 at 9:44
  • So I have a <apex:map> that is centred to the local city, I want the user to be able to click a point on the <apex:map> and then I want the coordinates of where they have clicked. – developer__c Aug 24 '16 at 9:45
  • 1
    I think, we can't do this using apex:map tag. Please go for google map api js. Only showing of map, marker/pins is done through apex:map tag. – Ankuli Aug 24 '16 at 9:48
  • Is it possible to interact with the apex:map? For example add an event listener? – developer__c Aug 24 '16 at 13:42
  • No. We can't add event listener to apex:map tag. It just render the map with markers. – Ankuli Aug 24 '16 at 13:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.