我有三个选择框:州、地区、学校。如果我没有学校,前两个效果很好,但学校实际上是重要的部分。没有学校选择一切正常。使用学校盒子我得到错误:
绑定失败,找不到元素:pid
氟氯化碳
<cfcomponent>
<cfset THIS.dsn="whatever">
<cffunction name="getDistricts" access="remote" returntype="query">
<cfargument name="state" required="yes" hint="The districts are in this state." />
<cfstoredproc datasource="#THIS.dsn#" procedure="getSchoolAndDistrict" returncode="yes">
<cfprocparam cfsqltype="cf_sql_varchar" dbvarname="@mstate" value="#arguments.state#" type="in">
<cfprocresult resultset="1" name="districts">
</cfstoredproc>
<cfreturn districts>
</cffunction>
<cffunction name="getSchools" access="remote" returntype="query">
<cfargument name="state" required="yes" hint="The districts are in this state." />
<cfargument name="pid" required="yes" hint="The district pid." />
<cfstoredproc datasource="#THIS.dsn#" procedure="getSchoolAndDistrict" returncode="yes">
<cfprocparam cfsqltype="cf_sql_varchar" dbvarname="@mstate" value="#arguments.state#" type="in">
<cfprocparam cfsqltype="cf_sql_varchar" dbvarname="@pid" value="#arguments.pid#" type="in">
<cfprocresult resultset="2" name="schools">
</cfstoredproc>
<cfreturn schools>
</cffunction>
</cfcomponent>
CFM
<cfoutput>
<cfform action="#CGI.PATH_INFO#" name="testdistricts" method="post">
<cfselect name="states" query="states"
queryPosition="below"
display="state" value="state">
<option value="">State</option>
</cfselect>
<cfselect name="districts"
bind="cfc:cfcs.getDistricts.getDistricts({states})"
queryPosition="below"
display="name" value="pid" bindonload="no">
<option value="">District</option></cfselect>
<cfselect name="schools"
bind="cfc:cfcs.getDistricts.getSchools({pid})"
queryPosition="below"
display="name" value="pid" bindonload="no">
<option value="">School</option>
</cfselect>
<br> <br>
<cfinput type="submit" name="submit" value="Submit">
</cfform>
</cfoutput>