Select to view content in your preferred language

Help altering a public Javascript

2695
17
Jump to solution
07-17-2014 01:55 PM
RyanLaird
Deactivated User

Hello everyone,

I'm currently having issues getting my script to work with data hosted on my companies server. The code is copy/pasted from the following link, and the goal is to perform the exact same function but with our data. So far I keep getting an "unexpected token" error for one of the colons on line 71.

Below is my script, it's completely unmodified other than the names of the data, but I could have mistyped anywhere, if you catch something, please let me know. I've attached an HTML file of the script I've adapted.

Thanks!

Tags (3)
0 Kudos
17 Replies
AlexanderNohe1
Honored Contributor

In addition, I believe that support is working on a series of blogs that help developers troubleshoot their scripts:

JavaScript Debugging Tips – Google Chrome Network Tab | Support Services Blog

RyanLaird
Deactivated User

Perfect, I'll be sure to give that a look-through!

0 Kudos
RyanLaird
Deactivated User

Thanks, I have that bookmarked for whenever I have time!

0 Kudos
RyanLaird
Deactivated User

Sorry guys, haven't had time to check out those tutorials/ webinars and we're hoping to get htis script done today. Just have one last problem, I got every thing else working. When you type the OBJECTID into the url (?OBJECTID=) it will bring you to the map but will not link to the selected polygon. I think the problem is in lines 147-168 (where the parcel is selected from the url).

Pretty sure the error is with the original code too, rather than my changes. Just like how I had to delete "mode: FeatureLayer.MODE_SELECTION" after my changes. Anyway, thanks for all the help fellas.

0 Kudos
TimWitt2
MVP Alum

I don't think I understand what you want to accomplish. Do you want to zoom to a feature when the user clicks on it?

RyanLaird
Deactivated User

Nope, It's already doing that from the popup. The goal is that when an OBJECTID number is added to the url (in the format specified in line 101) the maps selects and zooms tot he corresponding feature, like in the example.That way, we could send a client a link to the map, and it would automatically select and zoom to whatever feature they are interested in.

We're looking to do more with this script down the road, but I'll have time to check out more tutorials before than. My schooling in Javascript was unfortunately quite minimal.

0 Kudos
TimWitt2
MVP Alum

Ryan,

I wish I could help you, but I don't see the error. It might be good to start a new thread, since it got a little busy here

Tim

0 Kudos
RyanLaird
Deactivated User

Okay thanks again, Tim!

0 Kudos