programmher
Programmer
I have a form that could have up to 100 columns (based on what the user selects). I want all but the first 3 columns to default to the word BLANK. My below code is not working for all the fields - only for six fields throughout my entire form. Can anyone tell me why?
<cfloop index="i" from="1" to="100" step="1">
<cfset cname='column' & #i#>
<cfif #i# le listlen(attributes.selectedcols)>
<cfset selcount=i>
</cfif>
<td><cfselect name=#cname# size="1" required="Yes">
<cfif i GT 1 >
<option value="empty">Blank
</cfif>
<cfloop index="count" from="1" to="#listlen(allfields)#" step="1">
<cfif columnsort is 1>
<cfoutput>
<option value=#sfieldarray[count][1]#
<cfif #listgetat(attributes.selectedcols,selcount)# is #sfieldarray[count][1]#>SELECTED</cfif>
>#sfieldarray[count][2]#</cfoutput>
<cfelse>
<cfoutput><option value=#fieldarray[count][1]# <cfif #listcontainsnocase(listgetat(attributes.selectedcols,selcount),fieldarray[count][1])#>SELECTED</cfif>>#fieldarray[count][2]#</cfoutput>
</cfif>
</cfloop>
</cfselect></td>
<cfif #i# mod 10 eq 0></tr></cfif>
</cfloop>
<cfloop index="i" from="1" to="100" step="1">
<cfset cname='column' & #i#>
<cfif #i# le listlen(attributes.selectedcols)>
<cfset selcount=i>
</cfif>
<td><cfselect name=#cname# size="1" required="Yes">
<cfif i GT 1 >
<option value="empty">Blank
</cfif>
<cfloop index="count" from="1" to="#listlen(allfields)#" step="1">
<cfif columnsort is 1>
<cfoutput>
<option value=#sfieldarray[count][1]#
<cfif #listgetat(attributes.selectedcols,selcount)# is #sfieldarray[count][1]#>SELECTED</cfif>
>#sfieldarray[count][2]#</cfoutput>
<cfelse>
<cfoutput><option value=#fieldarray[count][1]# <cfif #listcontainsnocase(listgetat(attributes.selectedcols,selcount),fieldarray[count][1])#>SELECTED</cfif>>#fieldarray[count][2]#</cfoutput>
</cfif>
</cfloop>
</cfselect></td>
<cfif #i# mod 10 eq 0></tr></cfif>
</cfloop>