I have a dojo combobox that is populated with unique values. The user chooses a value, and the value is passed to a definition query, and the results displayed on the map. I can't get the results to display once the value is chosen from the combobox.

I"m pretty sure I'm not passing the value from the combobox to the definition query correctly, but not exactly sure where it goes wrong.

Here is my code http://plnkr.co/edit/eFzNtlO8DpkGYaaTpf8w?p=preview


i counted three problems with your code:

  1. you reference esri.layers.ArcGISFeatureLayer in your code, which threw an error in the console.

    Uncaught TypeError: undefined is not a function

The actual class is esri.layers.FeatureLayer and needed to be added to the list of AMD modules esri/layers/FeatureLayer.

  1. the second error i hit in the console was at this line var layerDefs = "agency LIKE '" + '%' + dom.byId("mySelect")

    Uncaught ReferenceError: dom is not defined

to fix that, i just had to add 'dojo/dom' to the AMD modules and give it an argument alias of 'dom'

  1. the third and final error was something i trapped in the network tab, the where clause wasn't returning features, because it was missing a trailing apostrophe, so i added it.

    agency LIKE '%DLIS%

var layerDefs = "agency LIKE '" + '%' + dom.byId("mySelect").value + '%'+ "'";

here's a working fork: http://plnkr.co/edit/PZdVjaqtKDVrPqD0B60E?p=preview

  • Awesome, thank you for the response! This was exactly what I was trying to do. The small little errors trapped me up, thought I had caught all of them. – shinyshiny Mar 27 '15 at 4:29
  • no worries. it takes practice, but getting familiar enough with the developer tools to interpret the messages it gives when things aren't working right is almost always the key to success. – john gravois Mar 27 '15 at 16:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.