>- see footer for list info -<
Hi All,
Attempting to use the Ryan M BeMiller example to chain two selects in a
form and not having much luck...
Here is my code...
<cfoutput>
<!--- the action goes to a page which just appends the appropriate
fields in the db --->
<form action="grDocsPagesAdd_Act.cfm" method="post"
enctype="multipart/form-data">
<input type="hidden" name="subHeading_required" value="Reference
Heading is required!">
<input type="hidden" name="headingID_required" value="Reference
Category is required!">
<table width="100%" border="0" cellpadding="4" cellspacing="1"
class="back_drkr">
<tr>
<td colspan="2" class="tbl_rowhdrs1">Add a new document</td>
</tr>
<tr>
<td class="tbl_rowhdrs2">Document Heading</td>
<td class="tbl_main"><input name="docName" type="text"
id="docName" value="">
</td>
</tr>
<!--- querying the headings table which contains headingID, headingName
--->
<cfquery name="qGetHeadings" datasource="groupRiskDocuments">
SELECT *
FROM headings
ORDER BY headingID
</cfquery>
<tr>
<td class="tbl_rowhdrs2">Document Topic</td>
<td class="tbl_main">
<!--- dynamically populate the first drop down list based on the
qGetHeadings query --->
<!--- I keep getting an error which has something to do with the cfif
below... Invalid CFML construct --->
<select name="headingID" required="yes"
onchange="this.form.submit()">
<option value="">-- Document Topics --</option>
<cfloop query="qGetHeadings">
<option value="#qGetHeadings.headingID#" <cfif
isDefined('form.headingID'><cfif form.headingID eq
"#headingID#">selected</cfif></cfif>>#qGetHeadings.headingName#</option>
</cfloop>
</select>
<!--- store the selected headingID after the select submits itself --->
<cfif isDefined('form.headingID')>
<cfset page.headingID = form.headingID>
</cfif>
</td>
</tr>
<!--- if the first selection has been made, display the second drop down
list with appropriate subheadings --->
<cfif isDefined('page.headingID')>
<!--- querying the subheadings table which contains subheadingID,
subheadingName, headingID, based on selected headingID from first query
--->
<cfquery name="qGetSubHeadings" datasource="groupRiskDocuments">
SELECT *
FROM subheadings
WHERE subheadings.headingID = #page.headingID#
ORDER BY subheadingID
</cfquery>
<tr>
<td class="tbl_rowhdrs2">Document Sub-topic</td>
<td class="tbl_main">
<!--- dynamically populate the second drop down list based on the
qGetSubHeadings query --->
<select name="subheadingID" required="yes">
<option value="">-- Document Sub-topics --</option>
<cfloop query="qGetSubHeadings">
<option
value="#qGetSubHeadings.headingID#">#qGetSubHeadings.subheadingName#</op
tion>
</cfloop>
</select>
</td>
</tr>
</cfif>
<!--- these are other fields that need to be updated, not involved with
the chained selects --->
<tr>
<td class="tbl_rowhdrs2">Date <i><span
class="riskdoctext">(dd/mm/yyyy)</span></i></td>
<td class="tbl_main"><input name="StoryUpdateDate" type="text"
id="StoryUpdateDate" value="<cfoutput>#DefaultDate#</cfoutput>"></td>
</tr>
<tr>
<td colspan="2" class="tbl_rowhdrs2">Story Text</td>
</tr>
<tr>
<td colspan="2" class="tbl_main">
<div id="docText">
<textarea name="docText" cols="300" rows="30" id="docText"
style="width:500px; height:200px;"></textarea>
</div></td>
</tr>
<tr>
<td class="tbl_rowhdrs2">Reference Document</td>
<td class="tbl_main"><input type="file" name="docFileName"
class="flat">
</td>
</tr>
<tr>
<td colspan="2" class="tbl_rowhdrs2">
<input name="Submit" type="submit" class="buttons" value="Add new
doc"> <input name="reset" class="buttons" type="reset" value="Clear
Form" /></td>
</tr>
</table>
</form>
</cfoutput>
_______________________________________________
For details on ALL mailing lists and for joining or leaving lists, go to
http://list.cfdeveloper.co.uk/mailman/listinfo
--
CFDeveloper Sponsors:-
>- cfdeveloper Hosting provided by www.cfmxhosting.co.uk -<
>- Lists hosted by www.Gradwell.com -<
>- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -<