Copy link to clipboard
Copied
Reference table
<Cfquery name ="getcode" datasource="this.datasource">
select *
from code
where (active_status = 'T')
</cfquery>
<CFSET FrequencyList="">
<CFSET FrequencyArray = Array(2)>
<CFSET FrequencyCount = "#GetCode.RecordCount#">
<CFOUTPUT Query="GetCode">
<CFSET RecordNum="#GetCode.CurrentRow#">
<CFSET FrequencyArray[#RecordNum#][1] = #GetCode.Frequencyt#>
<CFSET FrequencyArray[#RecordNum#][2] = #GetCode.Frequency_desc#>
</Cfoutput>
<TD> Frequency</TD>
<TR>
<TD>
<Select Name="Frequency">
<CFLOOP From="1" to="#FrequencyCount#" INDEX="Conter">
<CFIF #FrequencyArray[Counter][1]# eq 0>
<Option Value="<CFOUTPUT>#FrequencyArray[Counter][1]#</Cfoutput>">
<Cfoutput>#FrequencyArray[Counter][2]#</Cfoutput>
<Cfelse>
<Option Value="<CFOUTPUT>#FrequencyArray[Counter][1]# </Cfoutput>">
<Cfoutput>#FrequencyArray[Counter][1]# (#FrequencyArray[Counter][2]#)</Cfoutput>
</OPtion>
</CFIF>
</CFLOOP>
</Select>
</TD>
</TR>
The above code will load the Frequency drop down list from a database reference table query.
I am looking for a way to have the Frequency drop down list populated but also have the
Frequency drop down list show the value selected from another table query.
For example:
If the database query of a refernce table shows:
450
520
730
890
The select drop down would show:
450
520
730
890
But now, if a database query of the record table shows that 730 was the value selected before, the screen should show
450
520
730
890
but the value 730 would be shown in the drop down list as selected.
Thanks,
Mike
Copy link to clipboard
Copied
The selected attribute of the cfselect tag does that quite nicely.