Problem With CFLOOP
I have created a form in which an instructor can request to have software installed onto the computers in the lab. After the instructor submits the information is compiled in CFMAIL and is sent to the department head.
Of the many many form fields, two are key. CourseNumber and SectionNumber
The output of these Fields are lists, for example
Course = COM1010, ART1200, MATH0600
Section1 = 102 169 147, 254 141, 122
Note: The section field uses a comma (,) as the delimiter. The spaces represent multiple section numbers of a single course.
Using the above example
COM1010
-Section 102
-Section 169
-Section 147
ART1200
-Section 254
-Section141
I'm having a problem making it output correctly. Below is the code I am using:
Form.Course = COM1010, ART1200, MATH0600
Form.Section1 = 102 169 147, 254 141, 122
<cfloop index="ListItem1" list="#form.Course#">
#ListItem1#<br /> <!---Lists One Course Number--->
<cfif isdefined ("Count")>
<cfset Count = #Count# + 1>
<cfelse>
<cfset Count = 1>
</cfif>
<cfloop index="ListSection" list="#form.Section1#" from=#Count#> <!---My Problem is Here, CF is not accepting the "From" var, which is the key to this code working correctly--->
<cfset MultiSection=Findnocase(" ","#ListSection#")> <!---Looks for a space ( ) delimiter--->
<cfif #MultiSection# gt 0>
<cfset NewList=#ListSection#>
<cfloop delimiters=" " index="ListSub" list="#NewList#"> <!---Breaks thelist into a smaller list using spaces and lists each value--->
-#ListSub#<br />
</cfloop>
<CFELSE> <!---If no space ( ) found than do this--->
-#ListSection#<br /> <!---Lists 2nd Loop--->
</cfif>
<cfbreak> <!---Makes it only display the sections with the correct course--->
<cfloop><!---End of the Form.Section Loop--->
</cfloop> <!---End of Form.Course Loop--->
For the life of me I can't figure out why this is happening. Without "From" the code works but prints the section numbers into every course, instead of the ones they are supposed to be in.
If you have any suggestions I would really appreciate the help.
