3 Replies Latest reply on Dec 1, 2007 5:56 PM by Jim Buisman

    Issue with autosuggest on a numeric field

    Jim Buisman Level 1
      I have a form with a CFINPUT that has autosuggest to a cfc. The cfc runs a query against a varchar field that has only numeric values. When the match is made and the lis is returned I get an error (Bind failed for autosuggest CUSTOMER, bind value is not a 1D array of strings). This only happens with fields that are all numeric, if the field has any letters or symbols I do not have this issue.

      The data returned is coming back as numeric in scientific notation (CFC invocation response: [5.159000038E9]) The data is matching on the phone number and that is what is being returned.

      It there a way to correct this issue? Code sample is below.

      <cfinput type="text" name="CUSTOMER" size="10" maxlength="10" value="#CUSTOMER#" autosuggest="cfc:customerInfo.getCustomerSuggest({DSN}, {cfautosuggestvalue})">

      here is the function from the CFC:

      <cffunction name="getCustomerSuggest" access="remote" returntype="array" output="false">
      <cfargument name="argDB" type="string" required="yes">
      <cfargument name="argCUSTOMER" type="string" required="yes">

      <cfset var myarray = ArrayNew(1)>
      <cfquery name="cstInfo" datasource="#argDB#" maxrows="25">
      SELECT customer
      FROM custFile
      WHERE customer LIKE <cfqueryparam value="#argCUSTOMER#%" cfsqltype="CF_SQL_VARCHAR">

      <cfloop query="cstInfo">
      <cfset arrayAppend(myarray, '#customer# ')>
      <cfreturn myarray>