Coldfusion code with MS SQL back end.
My question is how do make my dorp down list dynamic.
My first drop down has a query= "qQuestTypes". Table name "tCLETestType" The primary key is qTypeID and qType as a coulmn name for the product name.
My Second dropdown has a query= "qTestDates" . Table Name "tCLETestVersion" The foreign key is qTypeID and qVersionIssuedate is my other colunm I need from the table.
Basically I have two products in my first drop down the qtypeid is the identifier I want to select one item from the first drop down and have it query based on qTypeID after selecting the item query the second table by qTypeId from first drop down which also is a column in the second table. Output qVersionIssueDate according to the first drop down qtypeId selection.
<cfparam name="qVersionIssueDate" default="">
<cfparam name="qType" default="">
<cfparam name="qTypeID" default="">
<cfparam name="lastname" default="">
<cfparam name="firstname" default="">
<cfparam name="barnumber" default="">
<cfparam name="PersonID" default="PCID">
<cfparam name="AddressID" default="AID">
<html>
<link rel="stylesheet" type="text/css" href="../../common/styles/
styles.css
">
<head>
<script language="javascript">
function fnGetqVersionIssueDate(){
document.quicktestsearch.m
ethod = "post"
document.quicktestsearch.a
ction = "cle_quicktestbyadmin.cfm?
PCID=#Pers
onID#&Last
Name=#Last
Name#&Firs
tName=#Fir
stName#&Ba
rNumber=#B
arNumber#"
document.quicktestsearch.s
ubmit()
}
</script>
</head>
<body>
<table border="0">
<form name="quicktestsearch">
<cfquery name="qQuestTypes" datasource="#odbcName#">
SELECT qTypeID, qType, qTypeDeleted
FROM tCLETestType
WHERE qTypeDeleted = 0 AND (qType = 'CLE' or qType ='DJ')
ORDER BY qType
</cfquery>
<tr>
<td width="200" class="txt">Select Publication Type</td>
<td width="200" class="txt">Select Test by Month and Year</td>
</tr>
<tr>
<td>
<select name="qType" class="txt" onChange="fnGetqVersionIss
ueDate()" >
<option value="" <cfif qType EQ "">selected</cfif>>
<cfloop query="qQuestTypes">
<option value="#qType#">#qType#</o
ption>
</cfloop>
</select>
</td>
<cfif isDefined("form.qType") and form.qType is not "">
<cfquery name="qTestDates" datasource="#odbcName#">
SELECT qVersionID,qVersionIssueDa
te, qVersionDeleted, qTypeID
FROM tCLETestVersion
WHERE qVersionDeleted = 0 AND qVersionActive = 1 AND (qTypeID = 7 or qTypeID =8)
ORDER BY qVersionIssueDate ASC
</cfquery>
</cfif>
<td>
<select name="qVersionIssueDate" class="txt" onChange="this.form.submit
();">
<option value="" <cfif qVersionIssueDate EQ "">selected</cfif>>
<cfif isDefined("qTestDates")>
<cfloop query="qtestdates">
<option value="#qVersionissueDate#
">#DateFor
mat(qVersi
onIssueDat
e, 'mmm yyyy')#</option>
</cfloop>
</cfif>
</select>
</cfoutput>
</td>
</tr>
</form>
</table>
</body>
</html>
<cfinclude template="cle_quicktestbya
dminresult
s.cfm">
Start Free Trial