tracker issue : CF-3036190

select a category, or use search below
(searches all categories and all time range)
Title:

Bug 73038:autosuggest fails if first record returned starts with a number

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/

Reporter/Name(from Bugbase): Jeff Coughlin / Jeff Coughlin (Jeff Coughlin)

Created: 09/19/2008

Components: AJAX, Plumbing

Versions: 9.0

Failure Type: Unspecified

Found In Build/Fixed In Build: 0000 / 227374

Priority/Frequency: Major / Unknown

Locale/System: English / Platforms All

Vote Count: 2

Problem:

autosuggest fails if first record returned starts with a number.

The following error message occurs (where nnn = the json field name being returned):

"widget: Bind failed for autosuggest nnn, bind value is not a 1D array of strings"

This error currently exists in CF8 through CF9 Alpha 1.  There is no known workaround other than implementing your own js library.

What appears to be happening is that CF is not wrapping quotes around the values (even if you attempt to convert your array values to strings by wrapping them in quotes (as seen in my example).

Suggested fix is to wrap all JSON values in quotes (unless here is a better way).  The only problem I see with this is how to handle true/false values should they be returned.

Sample code provided.
Method:

2 Files: parts.cfm and partsFacade.cfc

<!--- PARTS.CFM --->
<cfform name="packagingform" action="" method="post">
  <label for="partNumber" style="float: left; clear: left;margin-right:10px;">Part Number:</label>
    <cfinput type="text" id="partNumber" name="partNumber" style="float:left;clear:right;"
       autosuggestminlength="1"
       autosuggest="cfc:partsFacade.getPartNumberArray(partNumber={cfautosuggestvalue})" />
</cfform>

<!--- PARTSFACADE.CFC --->
<cfcomponent displayname="Parts Facade" output="false">
  <cffunction name="getPartNumberArray" access="remote" output="false" returntype="any" hint="Returns an array of part numbers (used for auto-suggest AJAX)">
    <cfargument name="partNumber" type="string" required="true" default="" hint="filter by part number" />
    <cfset var aReturn = [10000,"10111",10122,10133,12000,12001] />
    <cfreturn aReturn />
  </cffunction>
</cfcomponent>
Result:

widget: Bind failed for autosuggest nnn, bind value is not a 1D array of strings

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	3036190

External Customer Info:
External Company:  
External Customer Name: Jeff Coughlin
External Customer Email: 647F5E7B4480916D99201549
External Test Config: 09/19/2008

Attachments:

Comments:

I think this is a obvious fix...!!
Vote by External U.
24707 | November 10, 2011 06:52:57 PM GMT
This bug has been voted..
Vote by External U.
24708 | November 10, 2011 06:52:59 PM GMT