Question on how to use dijit/form/select in Arc JS API

5159
11
Jump to solution
05-29-2015 07:17 AM
JeffJohnson1
New Contributor II

I'm brand new to javascript, dojo and HTML and I've searched everywhere for examples of this and cannot find any.

I have a map with some feature points and a find task to highlight the feature points on the map, and display them in a grid with it's field attributes. This works great when I specify the search field as:

findParams.searchFields = ["LOCATION"];

But if I add:

findParams.searchFields = ["LOCATION", "MODEL_NUM"];

The grid displays results from multiple fields (ie. searching for attributes in LOCATION "A" would also find attributes in MODEL_NUM containing the letter "A"). So I decided to add a drop down menu select to specify which field to search in (one at a time) so the results are more precise.

So I added the following dijit:

<select id="fieldSelect" data-dojo-type="dijit/form/Select" name="fieldSelect">

          <option value="" selected="selected">Select a field</option>

          <option value="MODEL_NUM">Model Number</option>

          <option value="LOCATION">Location</option>

          <option value="NUM_DEFICIENCIES">Number of Deficiencies</option>

          <option value="INSTALL_DATE">Install Date</option>

</select>

I then modified the search field statement to:

findParams.searchFields = "[" + "\"" + dom.byId("fieldSelect").value + "\"" + "]";

When I click my search button I get an Uncaught TypeError: a.join is not a function (FindParameters.js:5)

I hope this is enough information. Does anyone have a solution or a recommendation?

Thanks.

Tags (3)
0 Kudos
11 Replies
thejuskambi
Occasional Contributor III

Ken is right, In you case you wont be able to get details through dom you need to use the registry.byId

0 Kudos
JeffJohnson1
New Contributor II

Alright guys, I found the problem in my code.

Ultimately it was the registry.byId that led me to the answer, I had to rearrange some code after I realized the searchFields was in the wrong function and not in the function that is called when I click the search button.

Thanks for all your help, everyone.

0 Kudos