I use a query task instead of find task here is a sample. function AddressSearchTask(stnum, stname, stcity)
{
streetname = stname.toUpperCase();
queryTask = new QueryTask("http://192.168.20.14:6080/arcgis/rest/services/emap12/MapServer/17");
query = new Query();
query.returnGeometry = true;
query.outFields = ["PRIMARYADD", "ZN"];
query.where = "HOUSENUMBE = '" + stnum + "' AND PRIMARYNAM LIKE '%" + streetname + "%'";
if(stcity != 0)
{
query.where = "HOUSENUMBE = '" + stnum + "' AND PRIMARYNAM LIKE '%" + streetname + "%' AND ZN = '" + stcity + "'";
}
queryTask.execute(query, pickAddress);
}
The 17 is the layer id from your service. You should be able to modify it to use your fields. query.where uses Standard Query Language(SQL) so you can use LIKE, IN, ect..This returns the results to another function called pickAddress function pickAddress(results)
{
AddrFeatures = results.features;
console.log(results);
var scount = AddrFeatures.length;
switch(scount)
{
case 0:
showMessage("asmessages", "Address not found");
break;
case 1:
zoomToStreet(results);
break;
default:
AddrResults = {displayFieldName: null, features:[]};
for (var i = 0; i < scount; i++)
{
var aResult = AddrFeatures;
if (!AddrResults.displayFieldName){ AddrResults.displayFieldName = aResult.displayFieldName }
AddrResults.features.push(aResult);
}
var stlist = addrList(AddrResults);
$("#addrlist").html(stlist);
$("#addrlist").show("slow");
break;
}
}
If more than one result is found it will create a pick list if only one result is found it will zoom to the point. Some of this code requires other functions and variable in order to function correctly which I have not included.BTW I have enclosed these function in jQuery in order to populate divs and tables. You can use the stardard ArcGIS JSAPI functions to do this if you like.Ray