• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Drop down list doesn't display selected value

New Here ,
Jun 27, 2006 Jun 27, 2006

Copy link to clipboard

Copied

Hi there,

I have a problem. This page output from the query result. There is 2 fields need to be updated:scholarshipID and amount. I want to update my query at once. My dynamic drop down list doesn't display selected value. The value is there but doesn't recognize it in the drop down list. I couldn't find the error. My code is below, so please help....

<cfquery name="getStudentsData" datasource="#application.DSN#">
select StudentID, fname, lname, GPA, Tbl_Students.ID, ScholarshipID, amount, Tbl_StudentsScholar.ID as SSID, AwardStatus
from Tbl_Students, Tbl_ApplyYear, Tbl_EduBckgrnd, Tbl_StudentsScholar
where Tbl_Students.ApplyYr = Tbl_ApplyYear.id
and Tbl_Students.id = Tbl_EduBckgrnd.SID
and Tbl_Students.ID = Tbl_StudentsScholar.SID
and ApplyYear = 1
and steps = 7
order by studentid
</cfquery>

<cfquery name="getScholarship" datasource="#application.DSN#">
select AcctNum, scholarship, Tbl_Scholarships.id, Code
from Tbl_Scholarships, Tbl_DistCode
where Tbl_Scholarships.DistCode = Tbl_DistCode.id
order by AcctNum
</cfquery>

<cfparam name="X" default="0">
<cfparam name="CounterX" default="0">

<!--- get scholarship --->

<cfif getStudentsDataRet.RecordCount eq 0>
<p class="paragraph">   No Records Found</p>
<p class="pageheight"></p>
<p class="pageheight"></p>
<cfelse>


<p class="submitmessage">   Records Found - <cfoutput>#getStudentsDataRet.Recordcount#</cfoutput></p>
<table width="98%" border="1" cellpadding="3" cellspacing="0" style="border-collapse:collapse" bordercolor="#000000" align="center">
<tr class="steptext2" bgcolor="#999999" align="center">
<td width="10%">Student ID</td>
<td width="9%">Last Name</td>
<td width="9%">First Name</td>
<td width="5%">GPA Cum</td>
<td width="5%">Account #</td>
<td width="5%">Amount</td>
<td width="20%">Account #|Dist Code|Scholarship Name</td>
</tr>

<form action="updateAward.cfm" method="post" name="AwardForm">
<cfoutput query="getStudentsDataRet">
<cfif x eq 0 and x neq getStudentsDataRet.recordcount>
<cfset x = 1>
<cfelseif x neq (getStudentsDataRet.recordcount +1)>
<cfset x = x + 1>
</cfif>
<tr class="paragraph">
<td>#StudentID#</td>
<td>#lname#</td>
<td>#fname#</td>
<td>#GPA#</td>


<cfif AwardStatus eq 2>
<cfquery name="getStudentsScholar" datasource="#application.DSN#">
select scholarship, Code, Tbl_Scholarships.id, AcctNum
from Tbl_Scholarships, Tbl_DistCode
where Tbl_Scholarships.DistCode = Tbl_DistCode.id
and Tbl_Scholarships.ID=#getStudentsDataRet.ScholarshipID#
</cfquery>
</cfif>
<td>
<select name="scholarshipID_#X#" onChange="showMessage_#X#(this.options[this.selectedIndex].value)">
<option value=""></option>
<cfloop query="getScholarshipRet">
<option value="#id#" <cfif getStudentsDataRet.ScholarshipID eq id>selected</cfif>>#AcctNum#</option>
</cfloop>
</select>
</td>
<td><input name="amount_#X#" type="text" size="5" <cfif amount gt 0>value="#NumberFormat(amount, 99.99)#"</cfif>/></td>
<td><cfif AwardStatus eq 2>#getStudentsScholar.AcctNum# | #getStudentsScholar.Code# | #getStudentsScholar.Scholarship# | #getStudentsDataRet.ScholarshipID#</cfif></td>
<input name="IndexID_#x#" type="hidden" value="#SSID#" />
</tr>
</cfoutput>
<cfoutput><input name="CounterX" type="hidden" value="#getStudentsDataRet.RecordCount#" /></cfoutput>
<tr>
<td align="center" colspan="11" height="50" valign="middle"><input name="Submit" type="submit" value="Submit" /></td>
</tr>
</form>
</table>
</cfif>
TOPICS
Advanced techniques

Views

490

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Participant , Jun 28, 2006 Jun 28, 2006
syntax is : getStudentsDataRet.ScholarshipID[1]

where '1' is the row number you want to specify

Votes

Translate

Translate
LEGEND ,
Jun 27, 2006 Jun 27, 2006

Copy link to clipboard

Copied

Here:
cfloop query="getScholarshipRet">
<option value="#id#" <cfif getStudentsDataRet.ScholarshipID eq id>selected</cfif>>#AcctNum#</option>
</cfloop>

Your cfif is probably never returning true. The fact that you are not specifying a row number for getStudentsDataRet.ScholarshipID could be significant.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 28, 2006 Jun 28, 2006

Copy link to clipboard

Copied

How can i specifying a row number?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 28, 2006 Jun 28, 2006

Copy link to clipboard

Copied

syntax is : getStudentsDataRet.ScholarshipID[1]

where '1' is the row number you want to specify

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 28, 2006 Jun 28, 2006

Copy link to clipboard

Copied

Try setting a variable inside the query loop and using that to check the scholarshipid in the loop. Also try using the id from the student table to name the fields.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 28, 2006 Jun 28, 2006

Copy link to clipboard

Copied

Thanks a million for all your help!!! Your comment is really appreciated.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 29, 2006 Jun 29, 2006

Copy link to clipboard

Copied

LATEST
GiGi05,
You shoulda marked Dan as the 'answer man' for this one. He did the heavy lifting.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation