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

What is wrong here?. Pls help me.

Subject: What is wrong here?. Pls help me.
From: "Adomacro"
Date: Mon, 13 Aug 2007 13:17:32 +0000 UTC
Newsgroups: macromedia.coldfusion.cfml_general_discussion
Class Table

 ClassId    StudId  Course              Mark
 10          101    Math                89
 10          101    IT                  65
 10          101    Biology             76
 10          101    Chemistry           33



 Course Table


 CourseName  Credit   
 Math          4
 Chemistry     3
 Biology       3
 History       3
 IT            4

 <cfquery name="class_table_q" datacourse="#dsn#">
        select ClassId,StudId,CourseName,Mark
        from class_table
 </cfquery>


 <cfquery name="course_table_q" datacourse="#dsn#">
        select CourseName,Credit 
        from course_table
 </cfquery>


 Based on Class Table value...i want to display drop down, textbox dynamic.
 I am not able to hold the values in drop down....why?...
 This is not setting values <cfif #class_table_q.Course# eq 
#CourseName#>selected</cfif>
 What i am doing wrong here?.

 How can i improve the code and hold the values in drop down?. Please help me.

 I am able to hold value in first drop down, second drop to nth drop value is 
coming same as first drop down value. 
 Query is returning value correct. 
 Some looping problem is causing not hold values in second to nth drop down.
 How can i fix?.
 Please my code below......thanks for all ur help.



 <cfif class_table_q.recordcount gt 0>
        <cfset editcount = 1>
        <input type="hidden" name="class_table_q_recordcount" 
value="<cfoutput>#class_table_q.recordcount#</cfoutput>">
        
        <cfloop query="class_table_q" startrow="1" 
endrow="#class_table_q.recordcount#">
                <tr>
                        <td>
                                <select name="Course_Name_#editcount#" 
onChange="document.forms['Course_frm'].Course_credit_#editcount#.value=this.valu
e.substring(0,this.value.indexOf(','));"> 
                                        <option value=""></option>
                                        <cfoutput query="course_table_q"> 
                                                <option 
value="#Credit#,#CourseName#" <cfif #class_table_q.Course# eq 
#CourseName#>selected</cfif>>#CourseName#</option> 
                                        </cfloop> 
                                </select>
                        </td> 
                        <td> 
                                <input type="text" 
name="Course_credit_#editcount#" 
value="#class_table_q.Course_credit#" size="2" maxlength="2">
                        </td> 
                        <td>
                                <input type="text" 
name="Course_Mark_#editcount#" 
value="#class_table_q.Course_Mark#" size="9" maxlength="9">
                        </td> 
                </tr>
                        <cfset editcount = editcount + 1>
        </cfoutput>
 </cfif>


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