Return values that include commas to select list

1 view
Skip to first unread message

Marty

unread,
Feb 15, 2008, 10:45:06 AM2/15/08
to mxAjax
Hi all,

Here is CF code that creates a CF array:

<cfloop query="schools">
<cfset arrayAppend(schoolArray, "#org_unit_cd#,#org_unit_nm#")>
</cfloop>


function populateDropDownMenus(source, target, cffunctionURL) {
var url = cffunctionURL;
new mxAjax.Select({
parser: new mxAjax.CFArrayToJSKeyValueParser(),
executeOnLoad: false,
target: target,
paramArgs: new mxAjax.Param(url,{param:"facultyCode={"+source
+"}", cffunction:"getSchoolArray"}),
source: source,
preFunction: function()
{ createActivityIndicatorImage(source) },
postFunction: function(response)
{ removeActivityIndicatorImage(); }
});
}

Marty

unread,
Feb 16, 2008, 10:22:47 AM2/16/08
to mxAjax
Hi all (again),

I pressed the "Send" button by accident. No doubt my original message
doesn't make sense at all. Below is the real original message that you
should read instead. Read on!

I've discovered a bug where mxAjax.Select chokes on a value that
contains a comma.

For example, an excerpt of the "getSchoolArray" ColdFusion function
(below) returns a CF array, which works fine including the
"org_unit_nm" variable that contains commas, e.g. "School of
Education, Science, Maths and Training" (notice the 2 commas there):

<cfloop query="schools">
<cfset arrayAppend(schoolArray, "#org_unit_cd#,#org_unit_nm#")>
</cfloop>
<cfreturn schoolArray>

Next is the JavaScript code that populates the "target" drop down menu
with the CF array data.
When it encounters values that contain commas such as "School of
Education, Science, Maths and Training", it truncates the value to
"School of Education" instead. It does not include the rest of it,
which is ", Science, Maths and Training".

Since the CF array of values do contain commas, I think the parser in
JavaScript which is mxAjax.CFArrayToJSKeyValueParser() is the real
culprit and therefore chokes on the commas.

Have we got a workaround? Have anyone got this problem and found the
solution? Thanks

function populateDropDownMenus(source, target, cffunctionURL) {
var url = cffunctionURL;
new mxAjax.Select({
parser: new mxAjax.CFArrayToJSKeyValueParser(),
executeOnLoad: false,
target: target,
paramArgs: new mxAjax.Param(url,
{param:"facultyCode={"+source+"}", cffunction:"getSchoolArray"}),

Marty

unread,
Feb 18, 2008, 12:41:27 AM2/18/08
to mxAjax
The fix is changing the comma (,) with perhaps a less frequently used
character such as the pipe character (|) on every instance about the
delimiter in the mxParser.js file so that commas are included as a
value rather than be used as a delimiter character.

I request that fix be included in the next version release as a couple
of other people are having this problem too.

Thanks,
Marty

Arjun....@gmail.com

unread,
Feb 25, 2008, 6:05:04 PM2/25/08
to mxAjax
Thanks for brining that to attention!

Arjun
Reply all
Reply to author
Forward
0 new messages