Entries for month: March 2005

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".

Powered by Mango Blog.