Hi, I have tried this, and whist the window now loads, the addQueryAddition function does not influebce the results. I feel we are very close!
I have searched for this function ut found no other use of it. Do you have any links to any references? Many thanks On Oct 20, 11:25 am, Jeremy Geerdes <[EMAIL PROTECTED]> wrote: > In the code that you have pasted now, I think all you need to do is > move line 91 up to line 88 (i.e., above that closing right curly > bracket). > > Jeremy R. Geerdes > Effective website design & development > Des Moines, IA > > For more information or a project quote:http://jgeerdes.home.mchsi.com > [EMAIL PROTECTED] > > Unless otherwise noted, any price quotes contained within this > communication are given in US dollars. > > If you're in the Des Moines, IA, area, check out Debra Heights > Wesleyan Church! > > On Oct 20, 2008, at 3:35 AM, superjeans wrote: > > > > > > > Hi Jeremy, once again thanks for your help... > > > Still no joy though... I get a load error with it. > > >http://yourpaste.net/1307/ > > > I realise I need to understand the code better. I can follow it > > roughly, but in comparison to C (where you can follow how things work > > much better) the functions are already written so it becomes a bit > > trickier. Do you have any good literature suggestions that may help > > me? > > Thanks > > > On Oct 17, 4:19 pm, Jeremy Geerdes <[EMAIL PROTECTED]> wrote: > >> Oops. Try this.gs.addQueryAddition(...); Notice the change of the > >> ls > >> to gs . Otherwise, leave the line the same. > > >> Jeremy R. Geerdes > >> Effective website design & development > >> Des Moines, IA > > >> For more information or a project quote:http:// > >> jgeerdes.home.mchsi.com > >> [EMAIL PROTECTED] > > >> Unless otherwise noted, any price quotes contained within this > >> communication are given in US dollars. > > >> If you're in the Des Moines, IA, area, check out Debra Heights > >> Wesleyan Church! > > >> On Oct 17, 2008, at 10:16 AM, superjeans wrote: > > >>> Hi Jeremy, > > >>> May thanks for the help again - it's very much appreciated. I have > >>> the > >>> postcode checker working for the UK format, but unfortunately I > >>> cannot > >>> get the line; > > >>> gsmsc.ls.addQueryAddition('Football Ground'); > > >>> .....to work. If I add it where you mention after the final } it > >>> causes the a load failure. > > >>> The full code is here: > > >>>http://yourpaste.net/1299/ > > >>> This is a snippet of he code > > >>> # > >>> var gsmsc=new GSmapSearchControl( > >>> document.getElementById("mapsearch"), > >>> "SWFC, Hillsborough, Sheffield, S6 1SW", > >>> options > >>> ); > > >>> } > >>> gsmsc.ls.addQueryAddition('Football Ground'); > >>> // arrange for this function to be called during body.onload > >>> // event processing > > >>> GSearch.setOnLoadCallback(LoadMapSearchControl); > > >>> </script> > >>> <!-- ++End Map Search Control Wizard Generated Code++ --> > > >>> # > > >>> Any ideas why it doesn't load? > > >>> On Oct 17, 12:53 pm, Jeremy Geerdes <[EMAIL PROTECTED]> wrote: > >>>> Well, now I'm more confused than I was before. The code you pasted > >>>> is > >>>> for the GSmapSearchControl (i.e., wizard-generated). But you are > >>>> asking about the google.maps.LocalSearch? The two things are > >>>> separate > >>>> and distinct, so I'm going to go with the code that you've already > >>>> got > >>>> working. > > >>>> So here's what you need to do. First, do NOT include the > >>>> gmlocalsearch.js and gmlocalsearch.css files into your page. They > >>>> are > >>>> unnecessary at this point. > > >>>> Second, we're going to focus on the block of code that looks like > >>>> this > >>>> in your paste: > > >>>> # > >>>> function LoadMapSearchControl() { > > >>>> var options = { > >>>> zoomControl : > >>>> GSmapSearchControl.ZOOM_CONTROL_ENABLE_ALL, > >>>> title : "SWFC", > >>>> url : "http://www.swfc.co.uk", > >>>> idleMapZoom : GSmapSearchControl.ACTIVE_MAP_ZOOM, > >>>> activeMapZoom : GSmapSearchControl.ACTIVE_MAP_ZOOM > >>>> } > > >>>> new GSmapSearchControl( > >>>> document.getElementById("mapsearch"), > >>>> "Sheffield Wednesday, Sheffield, S6 1SW ", > >>>> options > >>>> ); > >>>> } > > >>>> The first thing we're going to do in this block is add the > >>>> following > >>>> right under the first line (please note that, again, because I > >>>> don't > >>>> know what a post code is going to look like in your part of the > >>>> world, > >>>> I'm looking for a well-formed US ZIP code, whether it's valid or > >>>> not): > > >>>> GSmapSearchControl.prototype.newSearch = function(opt_query) { > >>>> if (opt_query) { > >>>> this.searchForm.input.value = opt_query; > >>>> } > >>>> if (this.searchForm.input.value && > >>>> this.searchForm.input.value.match(/^\d{5}(-\d{4})$/)) { // This is > >>>> the > >>>> line we changed! > > >>>> // clear markers, set prev/next > >>>> this.clearMarkers(); > >>>> GSmapsc_removeChildren(this.attributionDiv); > >>>> this.gs.execute(this.searchForm.input.value); > >>>> } > >>>> return false; > > >>>> } > > >>>> Please note that, with the exception of the denoted line, all of > >>>> the > >>>> preceding block is lifted straight from gsmapsearch.js. The change > >>>> is > >>>> to add in the && searchForm.input.value.match(...) bit, which will > >>>> make sure that we're looking at something that could at least pass > >>>> for > >>>> a valid post code at first glance. > > >>>> Once that's done, we need to change the line reading "new > >>>> GSmapSearchControl(" to the following: > > >>>> var gsmsc=new GSmapSearchControl( > > >>>> And then, right below that closing right curly bracket ( } ), we > >>>> need > >>>> to add this line: > > >>>> gsmsc.ls.addQueryAddition('Football Ground'); > > >>>> And that should do it. One word of caution, Groups is terrible at > >>>> adding newlines into the middle of your code, so please don't just > >>>> copy-paste straight out of here into your code. It'll probably > >>>> cause > >>>> more problems than it's worth. Otherwise, I hope that helps > >>>> without > >>>> muddying the water too much more! > > >>>> Jeremy R. Geerdes > >>>> Effective website design & development > >>>> Des Moines, IA > > >>>> For more information or a project quote:http:// > >>>> jgeerdes.home.mchsi.com > >>>> [EMAIL PROTECTED] > > >>>> Unless otherwise noted, any price quotes contained within this > >>>> communication are given in US dollars. > > >>>> If you're in the Des Moines, IA, area, check out Debra Heights > >>>> Wesleyan Church! > > >>>> On Oct 17, 2008, at 5:49 AM, superjeans wrote: > > >>>>> That's great, thanks. I guessed it was something like that. > >>>>> Unfortunately I cannot show you my map as it is on a private > >>>>> network. > > >>>>> My code however is here: > > >>>>>http://yourpaste.net/1296/ > > >>>>> So I need the following line: > > >>>>> searcher.setQueryAddition('Football Ground'); > > >>>>> Do I also need the lines: > > >>>>> <script src="http://www.google.com/uds/solutions/localsearch/ > >>>>> gmlocalsearch.js" type="text/javascript"></script> > >>>>> @import url("http://www.google.com/uds/solutions/localsearch/ > >>>>> gmlocalsearch.css"); > > >>>>> var lcs = new google.maps.LocalSearch(); > >>>>> map.addControl(new google.maps.LocalSearch()); > > >>>>> you my guess I'm new to JavaScript..... I'm a C++ man really! > > >>>>> On Oct 17, 11:16 am, Jeremy Geerdes <[EMAIL PROTECTED]> wrote: > >>>>>> Without a link to your exact implementation, it's impossible to > >>>>>> tell > >>>>>> you exactly what you need to do, but there are two things that > >>>>>> you're > >>>>>> going to want to do. First, to add the hidden query information, > >>>>>> you > >>>>>> want to use the searcher's .setQueryAddition method to add > >>>>>> "Football > >>>>>> Ground", like this: > > >>>>>> searcher.setQueryAddition('Football Ground'); // where searcher > >>>>>> is > >>>>>> the > >>>>>> LocalSearch object you're using > > >>>>>> Second, you're going to have to intercept the form's submit event > >>>>>> and > >>>>>> run a regular expression on the search query to make sure it > >>>>>> matches > >>>>>> the general pattern of a post code. For instance, if I was going > >>>>>> to > >>>>>> do this in the US with a ZIP code, I would use: > > >>>>>> if(!query.match(/^\d{5}(-\d{4})$/)){alert("That's not a valid ZIP > >>>>>> code!");} // where query is the query that the user is trying to > >>>>>> submit > > >>>>>> Jeremy R. Geerdes > >>>>>> Effective website design & development > >>>>>> Des Moines, IA > > >>>>>> For more information or a project quote:http:// > >>>>>> jgeerdes.home.mchsi.com > >>>>>> [EMAIL PROTECTED] > > >>>>>> Unless otherwise noted, any price quotes contained within this > >>>>>> communication are given in US dollars. > > >>>>>> If you're in the Des Moines, IA, area, check out Debra Heights > >>>>>> Wesleyan Church! > > >>>>>> On Oct 17, 2008, at 3:35 AM, superjeans wrote: > > >>>>>>> Hi, > > >>>>>>> I have created my searchable Google maps window for my website. > > >>>>>>> However, I want to be able to hide search criteria. > > >>>>>>> For example, I want the user to only enter a post code, but the > >>>>>>> actual > >>>>>>> search that is sent off to the server has the search term > >>>>>>> "Football > >>>>>>> Ground" as well as the post code. Thus, the search will only > >>>>>>> return > >>>>>>> the football grounds near the post code. > > >>>>>>> I'm sure this is extremely straightforward - please could > >>>>>>> someone > >>>>>>> point me in the right direction? Thanks- Hide quoted text - > > >>>>>> - Show quoted text -- Hide quoted text - > > >>>> - Show quoted text -- Hide quoted text - > > >> - Show quoted text -- Hide quoted text - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google AJAX APIs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/Google-AJAX-Search-API?hl=en -~----------~----~----~----~------~----~------~--~---
