cfgridに検索機能を追加しようとしています。しかし、「要素名はFORMで未定義です。エラー」が発生します。ページが初めて読み込まれると、グリッドが表示されます。しかし、検索ボタンを押した後、エラーが発生します。コードは次のとおりです。
<form name="DropDown" method="post">
<!--- query DB for the first drop down list --->
<cfquery name="Getprocedures" datasource="caselogs">
SELECT distinct procedures.procedure_name, procedures.procedure_id
FROM case_logs inner join procedures
on procedures.procedure_id=case_logs.procedure_id
WHERE case_logs.trainee_id=#form.name#
</cfquery>
<cfform action="#cgi.script_name#" method="post">
<select name="Ddl_form" size="1">
<cfoutput query="Getprocedures">
<option value="#procedure_id#" <cfif isDefined('form.Ddl_form')> <cfif form.Ddl_form eq "#procedure_id#">selected</cfif> </cfif>> #procedure_name#</option>
</cfoutput>
</select>
Status
<select name="Ddl_status" size="1">
<option value="P"<cfif isDefined('form.Ddl_status')> <cfif form.Ddl_status eq "P">selected</cfif> </cfif>>In Progress</option>
<option value="S"<cfif isDefined('form.Ddl_status')> <cfif form.Ddl_status eq "S">selected</cfif> </cfif>>Submitted</option>
<option value="R"<cfif isDefined('form.Ddl_status')> <cfif form.Ddl_status eq "R">selected</cfif> </cfif>>Reviewed</option>
<option value="-1" <cfif isDefined('form.Ddl_status')> <cfif form.Ddl_status eq "-1">selected </cfif> </cfif>>All</option>
</select>
<input type="submit" name="search" value="Search">
</cfform>
<cfif isdefined('form.search')>
<cfquery name="qGetBooks" datasource="caselogs">
SELECT CASE_LOGS.performed_dt,CASE_LOGS.submitted_dt,procedures.procedure_name,hospitals.hospital_code,case_logs.status
FROM case_logs
inner join procedures on procedures.procedure_id = case_logs.procedure_id
inner join hospitals on hospitals.hospital_id = case_logs.hospital_id
WHERE case_logs.trainee_id=2 and case_logs.status='#Form.Ddl_status#' and case_logs.procedure_id=#FORM.Ddl_form#
</cfquery>
<cfelse>
<cfquery name="qGetBooks" datasource="caselogs">
SELECT CASE_LOGS.performed_dt,CASE_LOGS.submitted_dt,procedures.procedure_name,hospitals.hospital_code,case_logs.status
FROM case_logs
inner join procedures on procedures.procedure_id = case_logs.procedure_id
inner join hospitals on hospitals.hospital_id = case_logs.hospital_id
WHERE case_logs.trainee_id=2 and case_logs.status='P'
</cfquery>
</cfif>
<cfform name="gridform">
<cfgrid name="BooksGrid"
format="HTML"
selectmode="row"
query="qGetBooks"
title="Students"
insert="true"
insertbutton="Insert Book"
width="500">
<cfgridcolumn name="performed_dt" header="DatePerformed" />
<cfgridcolumn name="submitted_dt" header="SubmitedDate" />
<cfgridcolumn name="procedure_name" header="Procedure" />
<cfgridcolumn name="hospital_code" header="Hospital" />
<cfgridcolumn name="status" header="Status" />
</cfgrid>
</cfform>
エラーは次のとおりです。
The error occurred in C:/ColdFusion10/cfusion/wwwroot/Caselogs/Trainee/caselogs.cfm: line 10
8 : select distinct procedures.procedure_name, procedures.procedure_id from case_logs
9 : inner join procedures on procedures.procedure_id=case_logs.procedure_id
10 : where case_logs.trainee_id=#form.name#
11 : </cfquery>
12 :