Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8517169
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T05:37:33+00:00 2026-06-11T05:37:33+00:00

example can be found at: http://projects.snowshtechnologies.com/findhrr/_admin/_geolocate/content.php view the source for the full idea. I

  • 0

example can be found at:

http://projects.snowshtechnologies.com/findhrr/_admin/_geolocate/content.php

view the source for the full idea.

I am trying to get the JS to populate the long/lat fields as soon as a text search result has re-positioned the map.

The linked Map script has a submit feature which returns the long lat back to a parent form (not included in this link – so don’t worry about that!)

There are two main methods here:

First is the text search – which is used to determine the map location buy entering an address. The required fix lies here, after the user clicks search, the map returns the position – all good. But I also now need the long/lat to appear in the text areas and enable the submit button.. you can see that functionality in the next method:

The second method simply allows the user to drag the map, the last clicked position will populate the lon/lat fields.

The txt search function:

function FindLoc(numResults)
{
    try
    {
       results = map.Find(document.getElementById('txtWhat').value,
                      document.getElementById('txtWhere').value,
                      null,
                      null,
                      index,
                      numResults,
                      true,
                      true,
                      true,
                      true,
                      MoreResults);
        index = parseInt(index)+9;

    }
    catch(e)
    {
        alert(e.message);
    }

    map.AttachEvent("onchange", DisplayCoords);
}

I have a function displayCoords that will output the clicked long/lat position to the page, I have included it in the text search function but no joy.

map.AttachEvent("onchange", DisplayCoords);

Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T05:37:34+00:00Added an answer on June 11, 2026 at 5:37 am

    I can’t change your sources so I can’t test this to be sure, however, I believe you want to do the following:

    1) Get rid of the “map.AttachEvent” in FindLoc, because this will attach a new event each time the user performs a find, and anyway it’s not a correct event name for the map type so it won’t be triggered. The list of valid events is here.

    2) Change your MoreResults callback so that it reads the resultsArray parameter, which is an array of find results, and reads the LatLong property from an array element. This class is documented here. For example, something like:

    var pos;
    if (resultsArray && resultsArray.length > 0) {
        pos = resultsArray[0].LatLong;
        if (pos) {
            document.getElementById("mapLatitude").value = pos.Latitude;
            document.getElementById("mapLongitude").value = pos.Longitude;
            document.getElementById('getLongLat').style.display='block';
        }
    }
    

    Edit: The resultsArray always seems to be null, so you need to use the places array instead. Add this to the beginning of MoreResults:

    if (places && places.length > 0) {
        document.getElementById("mapLatitude").value = places[0].LatLong.Latitude;
        document.getElementById("mapLongitude").value = places[0].LatLong.Longitude;
        document.getElementById('getLongLat').style.display='block';
    }
    

    I tested this alternative, and it does work for me.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I found and followed an example from Stackoverflow (http://stackoverflow.com/questions/2310139/how-to-read-xml-response-from-a-url-in-java) of how to read an
For example the following cast can be found littered throughout the MSDN documentation: (LPTSTR)&lpMsgBuf
I'm trying to follow the Auth example for Webapp2 that can be found here:
So I can't seem to find a good example of this anywhere. I found
I found a bug, and tracked it down. You can see a simplified example
I learn Symfony 2. I would like have example with SonataAdminBundle. I found: http://sonata-project.org/bundles/news/2-0/doc/reference/installation.html
I want to use the http://getsharekit.com framework for future iOS projects. Hence I started
I'm using the latest version of iTextSharp found here: http://sourceforge.net/projects/itextsharp/ I am trying to
I've found a flex paging example I'd like to get working, but can't seem
For example can I go: string[] keys = new string[items.Count]; items.Keys.CopyTo(keys); Where items is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.