• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 599
  • Last Modified:

Google XML Issue - Results not working as expected...

Hello,

I have created a web page that returns a list of locations from Google Maps, when there are more than one result found, however when clicking on one of the results to confirm which I want, it doesn't seem to listen and simply reloads the page.  I have tried to alter the 'h ref' and direct the click straight to the confirmation page, however this unfortunately stops any of the code showing on the page, which is really strange...!

The HTML generated is:

<?xml version="1.0" encoding="ISO-8859-1"?>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-32" />
<title>Searching Address</title>
</head>
<body>
<form name="form1" method="post">
Fürth, GermanyThe address you requested returned multiple possibilities:<p><p><a href="searchaddress.asp?address=Fürth, Germany">Fürth, Germany</a></p><p><a href="searchaddress.asp?address=Furth, Germany">Furth, Germany</a></p><p><a href="searchaddress.asp?address=Furth im Wald, Germany">Furth im Wald, Germany</a></p><p><a href="searchaddress.asp?address=Fürth, Germany">Fürth, Germany</a></p></p><P>If the address is not listed, please try again, perhaps adding in more information:<p> <input type="text" size="50" name="address" id="address" value="Fürth, Germany" /><input type="submit" id="searchagain" name="searchagain" value="Search Again" /></p>

</form>
</body>
</html>

I have attached the ASP page here too.

Thanks for your help!
0
Nico2011
Asked:
Nico2011
  • 6
  • 3
  • 3
1 Solution
 
Kim WalkerWeb Programmer/TechnicianCommented:
Could it be the spaces in your query string? Try url encoding the href.
0
 
Nico2011Author Commented:
Thanks but that doesn't work either...
0
 
Kim WalkerWeb Programmer/TechnicianCommented:
Does the file "searchaddress.asp" have code to process the query string? You said you attached the asp page but I don't see an attachment.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
Nico2011Author Commented:
Aha - I'm to EE, so didn't see the 'Attach' button after browsing - should have known better...!  Attached now!  

Yes, there is some code, but a redirect.  It's really strange because as soon as the page name is changed, the page no longer works at all...!  Essentially, it is sent an addess through a querystring, which it then processes.  If it finds the address first time, then it forwards the user to a page and shows this on a map, but if there are more than one result found for the location (such as furth in Germany) it loops back on itself.  Sometimes however, if there is a larger list of results, it will work - as in takes the address te user has clicked on as the correct one, and passes it to the next page with the map.

Thanks again!
searchaddress.txt
0
 
Kim WalkerWeb Programmer/TechnicianCommented:
Unfortunately, it's been ten years or more since I last looked at ASP. I got involved in this question because JavaScript was listed as one of the topics. Perhaps an ASP expert will join in, but you may have to repost the question with a different title that will attract ASP experts.

From what I've been able to understand from your code and my experience with Google maps, I'm wondering if the addresses listed will always return multiple possibilities. Have you tried searching for one of the alternatives first? Does it still return multiple addresses? If so, you may have to include more than just the address in your secondary searches.

In your initial post, it appears you have started a search for "Fürth, Germany" and received four possibilities. However, the first and last possibility are exactly the same as the initial search. Clicking either of those choices will repeat the exact same process again since the query string for both is exactly the same as the initial request, "Fürth, Germany".
0
 
Nico2011Author Commented:
Thanks for your help.  I did try to add on the lng/lat to each line, but when I do that, the first record never has that information - the others do...

Yes, sometimes the address gets found and the page bounces straight through to the map page, and it's only when there are multiple possibilities that this problem occurs.

I'll do as you suggest and repost - sorry I put Javascript in the topics - I'm working on so many pages and didn't realise this one doesn't have javascript...!
0
 
aikimarkCommented:
do your links now look like this?
href="searchaddress.asp?address=Fürth,%20Germany"

Open in new window

0
 
Nico2011Author Commented:
Thanks - no they don't - they look like this: <a href="searchaddress.asp?location=Fürth, Germany">Fürth, Germany</a>

If I try to URL encode the URL, the page stops working altogether...!

(sorry I took so long to come back - I have been away)
0
 
aikimarkCommented:
If you have a search argument that doesn't include any space characters, does the link work?
0
 
Nico2011Author Commented:
nope - not at all...!  You can see what I'm up to at www.gorgeous-villas.com/index2.asp - try searching for Furth and you'll see the problem I'm having.  Thanks for your help!
0
 
aikimarkCommented:
1. I think you should be using location= rather than address=
2. When you retrieve the data for the combobox, it would be better if you assigned the key value to each entry and do your search by the location key value, instead of the name of the location.
0
 
Nico2011Author Commented:
That works!  BUT I did have to add in a procedure to prevent the name coming up loads of times - for some reason, Google Maps has the same name with multiple lng/lat addresses.  Most important thing is that it now works - thank you so much.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 6
  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now