Adding Multiple Search Drop Down Menus to Map (Fusion Tables)

131 views
Skip to first unread message

Amelia Griza-Padilla

unread,
Aug 15, 2011, 1:04:51 PM8/15/11
to google-map...@googlegroups.com
Hello,
I am trying to create two drop down menus (would actually like to add a third) that searches for records based off my fusion tables. I am able to get one of the drop menus to work, but once I add the secod drop down menu neither one works. Can anyone give some guidance to what I am missing here? http://www.advocacy.ucla.edu/Maps/Assembly_map.html
 
Thanks,
Amelia

Radina

unread,
Aug 15, 2011, 7:00:28 PM8/15/11
to Google Maps JavaScript API v3
Amelia:

Pay attention to id and function names. Should be unique.

As a first step try renaming as follows:

<label>Current District Number </label>
<select id="searchString2" onchange="changeMap2(this.value);">

function changeMap2() {
var searchString2 =
document.getElementById('searchString2').value.replace("'", "\\'");
if(searchString2 == "") {
layer.setQuery("SELECT 'geometry' FROM " + tableid);
return;
}
layer.setQuery("SELECT 'geometry' FROM " + tableid + " WHERE
'District' = '" + searchString2 + "'");
}

Once you have that working, try to parametrize changeMap and to have
only one fuction.

Radina
On Aug 15, 10:04 am, Amelia Griza-Padilla <ameliagpadi...@gmail.com>
wrote:n
> Hello,
> I am trying to create two *drop down menus* (would actually like to add a
> third) that searches for records based off my fusion tables. I am able to
> get one of the *drop menus* to work, but once I add the secod *drop down
> menu* neither one works. Can anyone give some guidance to what I am missing
> here?http://www.advocacy.ucla.edu/Maps/Assembly_map.html
>
> Thanks,
> Amelia

Amelia Griza-Padilla

unread,
Aug 18, 2011, 12:53:48 PM8/18/11
to Google Maps JavaScript API v3
Thank you so much Radina, I got it to work (I've just started with
javascript and google maps for about a two weeks and so it's making
more and more sense:) )


http://www.advocacy.ucla.edu/Maps/Assembly_Map.html


On Aug 15, 4:00 pm, Radina <radi...@gmail.com> wrote:
> Amelia:
>
> Pay attention to id and function names. Should be unique.
>
> As a first step try renaming as follows:
>
>  <label>Current District Number </label>
>   <select id="searchString2" onchange="changeMap2(this.value);">
>
> function changeMap2() {
>   var searchString2 =
> document.getElementById('searchString2').value.replace("'", "\\'");
>   if(searchString2 == "") {
>     layer.setQuery("SELECT 'geometry' FROM " + tableid);
>     return;
>   }
>   layer.setQuery("SELECT 'geometry' FROM " + tableid + " WHERE
> 'District' = '" + searchString2 + "'");
>
> }
>
> Once you have that working, try to parametrize changeMap and to have
> only one fuction.
>
> Radina
> On Aug 15, 10:04 am, Amelia Griza-Padilla <ameliagpadi...@gmail.com>
> wrote:n
>
>
>
> > Hello,
> > I am trying to create two *dropdownmenus* (would actually like to add a
> > third) that searches for records based off myfusiontables. I am able to
> > get one of the *dropmenus* to work, but once I add the secod *dropdown
> >menu* neither one works. Can anyone give some guidance to what I am missing
> > here?http://www.advocacy.ucla.edu/Maps/Assembly_map.html
>
> > Thanks,
> > Amelia- Hide quoted text -
>
> - Show quoted text -
Reply all
Reply to author
Forward
0 new messages