AnsweredAssumed Answered

Query based on user input

Question asked by thebillcarr on Apr 3, 2014
Latest reply on Apr 3, 2014 by thebillcarr
Greetings,
Pardon my inexperience, I am trying to create a query app based on a users input. My issue is getting the input into the query task.

        on(dom.byId("execute"), "click", execute);          function execute () {           query.where = "FIRSTNAME='" + stateName +"'";            queryTask.execute(query, showResults);         }          function showResults (results) {           var resultItems = [];           var resultCount = results.features.length;           for (var i = 0; i < resultCount; i++) {             var featureAttributes = results.features[i].attributes;             for (var attr in featureAttributes) {               resultItems.push("<b>" + attr + ":</b>  " + featureAttributes[attr] + "<br>");             }             resultItems.push("<br>");           }           dom.byId("info").innerHTML = resultItems.join("");         }



I'm not sure where I'm getting my wires crossed, if it is the input or the query.

[HTML]<input type="text" id="stateName" value="California">
    <input id="execute" type="button" value="Get Details">[/HTML]

The example is pretty much the needed functionality, but I need to be able to specify the query field.
Any help is greatly appreciated.

Outcomes