macromedia.coldfusion.cfml_general_discussion
[Top] [All Lists]

Re: Expert's help need...Please help

Subject: Re: Expert's help need...Please help
From: "Steve Sommers"
Date: Sat, 18 Aug 2007 00:12:50 +0000 UTC
Newsgroups: macromedia.coldfusion.cfml_general_discussion

In rereading your code, I think I see the problem. Try the following. Query 
loops have a tendency to get confused when multiple loops are involved. 
Referencing student_details_q.course_selected only references the first row, 
not the current row, which I believe is your problem.

 <cfif student_details_q.recordcount gt 0>
        <cfset editcount = 1>
        <input type="hidden" name="student_details_q_recordcount" 
value="<cfoutput>#student_details_q.recordcount#</cfoutput>">
        <cfloop query="student_details_q" startrow="1" 
endrow="#student_details_q.recordcount#">
                <tr>
                        <td>
                                <select name="Course_#editcount#" 
onChange="document.forms['Course_frm'].Course_credit_#editcount#.value=this.valu
e.substring(0,this.value.indexOf(','));"> 
                                        <option value=""></option>
 <cfset my_course_selected=course_selected>
                                                <cfoutput query="course_q">
                                                        <option 
value="#credit#,#course#" <cfif #my_course_selected# eq 
#course#>selected</cfif>>#course#</option> 
                                                </cfoutput> 
                                </select>
                                </td> 
                        <cfoutput>
                        <td> 
                                <input type="text" 
name="Course_credit_#editcount#" 
value="#student_details_q.Course_credit#" size="2" maxlength="2">
                        </td> 
                        <td>
                                <input type="text" 
name="Course_Fee_#editcount#" 
value="#student_details_q.Course_Fee#" size="9" maxlength="9">
                        </td> 
                </cfoutput>
                </tr>
                <cfset editcount = editcount + 1>
        </cfloop>
 </cfif>


<Prev in Thread] Current Thread [Next in Thread>