Dynamic drop list


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 load frequency drop down list database reference table query.
i looking way have frequency drop down list populated have the
frequency drop down list show value selected table query.

for example:

if database query of refernce table shows:
450
520
730
890

 

the select drop down show:
450
520
730
890

 

but now, if database query of record table shows 730 value selected before, screen should show

450
520
730
890

but value 730 shown in drop down list selected.

 

 

 

thanks,

 

 

mike

the selected attribute of cfselect tag quite nicely.



More discussions in ColdFusion


adobe

Comments

Popular posts from this blog

How to change text Component easybook reloaded *newbee* - Joomla! Forum - community, help and support

PProHeadless.exe has stopped working error when opening projects in Adobe Media Encoder CS6

Preconditions Failed. - Joomla! Forum - community, help and support