Bug in CFMX7 XSL and CFSELECT

I've been playing around with the XSL forms in Coldfusion MX 7 and ran into a bug yesterday. If I have a multiple select, then the XSL style sheets don't properly mark each selected value as such. Let's say I have this code:

<cfselect 
	name="PhaseIDs" 
	label="Assigned Phases: " 
	query="rsPhaseList"
	value="PhaseID"
	display="PhaseName"
	selected="#Book.getPhaseIDs()#"
	size="10" 
	multiple="yes"
></cfselect>

I would expect CF to spit out a select menu with all of the values retrned by #Book.getPhaseIDs()# selected. Unfortunately, nothing gets selected. I found this code in _formelements.xsl:

With that code, if I pass multple values, nothing will ever get selected, since $selectedValues contains a comma delimted list of values (2,6,10 will never match 2 [the current ID]). So I hit up the Coldfusion TMMs for some help, and S. Isaac Dealey of FusionTap came back with this fix:

That code tacks a comma at the beginning and end of the list of selected values, and then uses contains to find out if the list contains the string ",2," instead of just "2".

Posted by Daniel Short on Mar 6, 2005 at 12:00 AM | Categories: ColdFusion -

2 Comments

Nic Tunney

Nic Tunney wrote on 11/11/05 7:48 PM

Upgrade to 7.0.1. This has been fixed. There is still one outstanding issue. See these posts: Fixed: http://nictunney.com/index.cfm?mode=entry&entry=FC1BDDD7-99FA-70E1-C95850B67BA7C527 Not fixed: http://nictunney.com/index.cfm?mode=entry&entry=FC3D33A7-C4B8-8401-97C482C47DDE1D50
Daniel Short

Daniel Short wrote on 11/11/05 7:49 PM

Sweet! My CFMX7 Upgrade went in the mail today, so I'll be updating my production server form 6 to 7 in the next few weeks. CFFORM here I come!