Interesting ColdFusion 8, Auto-Suggest issue to watch for

Thanks to Ed Tabara for pointing this out. If you type "1" in the search field at ColdFusion Bloggers, you will get a JavaScript error:

The page at http://www.coldfusionbloggers.org says:Bind failed for autosuggest search_query, bind value is not a 1D array of strings [Enable debugging by adding 'cfdebug' to your URL parameters to see more information]

If you introspect the result from my server, you see something like this:

[10.0,123.0,"1ssblog","1smartsolution"]

Notice that the first two results were numbers, not strings. I tried to 'fool' JSON a bit. I added "" to the number to see if that would do it and it didn't work. Interestingly enough, if you add " " to your data, serializeJSON will keep the padding on the strings, but removes it from the numbers. So even though my data was "10(space)", serializeJSON ignored it.

So it looks like 2 possible bugs. The client side code should allow for any simple value in the array - numbers, strings, or dates. And it looks like maybe serializeJSON is a bit overzealous in converting values. I can understand converting 10 to 10.0, but "10(space)" should be left alone, especially if "Ray(space)" is left alone.

Comments

It is odd. If you try every number (0-9), some error ... some pull results, and others just do nothing. For instance, 1 and 3 error but 2 does nothing. 5 on the other hand finds the result "500 error".
# Posted By Kevin Benore | 3/17/08 3:26 PM
Putting an underscore _ wont error, but it also wont show the result found, which is:

["test","camden","getter","robot chicken","william ukoh","william","coldfusion rocks","a","andrea","chad"]
# Posted By Don | 3/18/08 2:28 PM
I am just testing your flex solution to the blog engine. Might consider one myself, this looks interesting for sure
# Posted By Doron Katz | 4/7/08 6:19 PM
This is a strange bug. Its now been logged as a bug in our bugtracker.

Thanks for pointing it out.
# Posted By Rakshith | 4/10/08 11:37 PM
It does the exact same thing for binding values to a drop down to auto-populate. In my case, it converted my "Yes" to "true".
# Posted By PhilNg | 5/11/08 9:53 PM