ColdFusion 8 Ajax - binding and strings with commas - part 2

In order to visualize and for people to better understand the problem, and also try out any solutions they might think of, I whipped together a small example.

Use the download link bellow to download a zip file with a index.cfm and a mycfc.cfc file.

Unzip somewhere under the webroot on a CF8 server and open index.cfm in your web browser.

Now you see a grid which is populated with artists from the cfartgallery db that is installed with CF by default.

There is also a text input field. Type in a single artistID (1) and submit, and the grid will return the one artist with that artistID. Type in more than one in a comma separated list (1,2,3) and submit. Theoretically the grid should return the 3 artists with the submitted artistID's. Instead you'll see the error I was talking about:

Error parsing bind cfc:mycfc.getArtists({cfgridpage},{cfgridpagesize},{cfgridsortcolumn},{cfgridsortdirection},'1,2')
You cannot specify more arguments to a CFC function than it declares.

Related Blog Entries

Comments
I managed to get this working. I had to setup some binding instead of passing the values in directly (I'm not sure what gets converted automagically, but when I do it this way it works without any other data manipulation on my part)

Change the input field like so:
<input id="artistIDlist" name="artistIDlist" type="text" value="<cfoutput>#form.artistIDlist#</cfoutput>" />

Then change the bind value from
'#form.artistIDlist#'
to
{artistIDlist}

Make sure to add a cfqueryparam to the back end and some javascript validation to the front to prevent errors, but other than that, it should work correctly for you now.
# Posted By Gareth | 4/9/08 9:44 AM