Jump to content
Sign in to follow this  
Paxman

Help Paxman Succeed and hopefully you will too

Recommended Posts

»Paxman    4776

Hi guys! As you all know by now (probably), I'm not a very good coder in any language, but I've been assigned to a section at work that involves the use of HTML (which is easy and I know), Javascript (sort of know but not greatly), PHP (ehhhh), and SQL (again, sort of know) in conjunction with the Google Maps API.

 

I'll be using this thread to put forward questions I may have when doing work at home in an attempt to learn things better, or maybe I'll be doing work I sent home. Either way I don't wanna look like that douche nozzle who can't figure things out on his own at work, but on the flipside I currently have no interest in coding that much (hopefully this will change in a few months). So please feel free to discuss anything about the aforementioned languages or Google API (if you've used it) or even the Google Fusion Maps API (which I just learned about today and am enjoying thusfar).

 

I will be posting questions as they come across, but if anyone else who is not supremely good at coding or wants to learn, but forward stuff ITT and I will try and help as I learn or you can help me learn. 

 

<3

  • Upvote 2
  • Downvote 2

Share this post


Link to post
Share on other sites
»Paxman    4776
function changeMap1() {
 
var filterString = document.getElementById('filterstring').value.replace(/'/g, "\\'");
 
if (filterString == "No Filter")
{
layer.setOptions({
query: {
select: 'geometry',
from: '1DpKWD4uucKPTbWYCTJFVKAelCbncHHyV4btiTlw'
},
});
}
 
else if (filterString == "HEAVYLIGHT")
{
layer.setOptions({
query: {
select: 'geometry',
from: '1DpKWD4uucKPTbWYCTJFVKAelCbncHHyV4btiTlw',
where: "'Rest Area Type' = 'Heavy and Light Vehicle Rest Area'"
},
});
}
 
else if (filterString == "LIGHT")
{
layer.setOptions({
query: {
select: 'geometry',
from: '1DpKWD4uucKPTbWYCTJFVKAelCbncHHyV4btiTlw',
where: "'Rest Area Type' = 'Light Vehicle Rest Area'"
},
});
}
 
else if (filterString == "LOAD")
{
layer.setOptions({
query: {
select: 'geometry',
from: '1DpKWD4uucKPTbWYCTJFVKAelCbncHHyV4btiTlw',
where: "'Rest Area Type' = 'Load Checking Area'"
},
});
}
 
else
{
layer.setMap(null);
}
 
 
}
 
 
<select id="filterstring" onchange="changeMap1(this.value);">
<option value="No Filter">--No Filter--</option>
<option value="HEAVYLIGHT">Heavy and Light Vehicle Rest Area</option>
<option value="LIGHT">Light Vehicle Rest Area</option>
<option value="LOAD">Load Checking Area</option>
</select>
 
 
Anyone know why this won't work?

Share this post


Link to post
Share on other sites
»Paxman    4776
No I should jump on stack overflow but I prefer a community I know if a few coders exist. I will likely find the answer before someone answers but it's nice to have this here as well.

Share this post


Link to post
Share on other sites
»Paxman    4776

AHh thanks for that. No one was posting so I assumed no one was looking. Turns out the function was fine I had just accidently declared the layer variable twice above that function. Thank you though!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×