Click here to Skip to main content
15,886,873 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi I have this following code:

JavaScript
function reverseGeocodeRequest() {
          createSearchManager();
          var userData = { name: 'Maps Test User', id: 'XYZ' };
          map.setView({ zoom: 10 });
          var request =
          {
              location: new Microsoft.Maps.Location(38.711232538952245, -9.13513183593749),
              callback: onReverseGeocodeSuccess,
              errorCallback: onReverseGeocodeFailed,
              userData: userData
          };
          searchManager.reverseGeocode(request);
      }

But the coordinates are inserted manually, I want to give that values by textbox´s can anyone help me?

Regards.
Posted
Updated 28-Aug-12 9:06am
v2
Comments
enhzflep 28-Aug-12 15:28pm    
Step 1. - Add two input boxes. Make them uniquely identifiable (give them a unique id)
Step 2. - use document.getElementById('yourElementId') to get the element
Step 3. - use .value to get the text in an input text-box

<input id='longInput'/>
<input id='latInput'/>
longElem = document.getElementById('longInput');
longVal = longElem.value;
latElem = document.getElementById('latInput');
latVal = latElem.value;

------
function reverseGocodeRequest(longitude, latitude)
..
..
var request =
{
location: new Microsoft.Maps.Location(longitude, latitude),
..
..
etc.
hh_7 29-Aug-12 4:29am    
Thanks!!

1 solution

JavaScript
function reverseGeocodeRequest() {
          var latitude = document.getElementById('txtLatitude').value;
          var longitude = document.getElementById('txtLongitude').value;
          createSearchManager();
          var userData = { name: 'Maps Test User', id: 'XYZ' };
          map.setView({ zoom: 10 });
          var request =
          {
              location: new Microsoft.Maps.Location(latitude, longitude),
              callback: onReverseGeocodeSuccess,
              errorCallback: onReverseGeocodeFailed,
              userData: userData
          };
          searchManager.reverseGeocode(request);
      }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900