我有一个 JS 函数,它根据用户从下拉列表中选择的内容创建一个变量。我需要在我的 CF 代码上使用该 JS 变量,以便能够在提交表单以外的操作中使用它。
这是我的 JS 函数
function handleProcedureChange(procedureid,recID)
{
procedureid= document.form1.procedure.value;
recID = document.form1.recID.value;
state = document.form1.state.value;
state = state.trim();
city = document.form1.city.value;
city = city.trim();
var url ="../../../../cf_modules/components/customDescriptions.cfc?method=procedureDescription&";
url=url+"ProcedureID="+procedureid+"&recID=" + recID + "&state=" + state + "&city="+city;
$.get(url, function(procedureResult) {
procedureResult = procedureResult.replace(/^"+|"+$/g, "");
$("#procedureDescription").text(procedureResult);
});
}
这是我的表格
<select name="procedure" onChange="handleProcedureChange();">
<option value="">Select Procedure</option>
<cfloop query="procedures">
<option value="#procedureId#">#procedureName#</option>
</cfloop>
</select>
<textarea name="procedureDescription" id="procedureDescription" cols="80" rows="6"></textarea><br />
我需要在此链接上使用url2变量来控制几个服务器端功能
这些是链接序列
<cfoutput>[<a href="cityEdit.cfm?recID=#recID#&delete1=#recID#&state=#state#&city=#city.getCity()#&procedureid=#procedure#">delete</a>]</cfoutput>
<cfif delete1 neq "">
Are you sure?
<cfoutput> [ <a href="cityEdit.cfm?recID=#recID#&delete1=#delete1#&delete2=#delete1#&procedureid=#procedure#&state=#state#&city=#city.getCity()#">Yes</a> | <a href="cityEdit.cfm?recID=#recID#">No</a>]</cfoutput>
</cfif>
这些是上述链接控制的功能:
<cfparam name="delete1" default="">
<cfparam name="delete2" default="">
<cfif delete1 neq "">
<cfquery name="procFinder" datasource="#ds#">
select * from psp_customDescriptions where recID = '#delete1#'
and procedureID = '#procedure#' and city = '#city#' and state='#state#'
</cfquery>
</cfif>
<cfif delete2 neq "">
<cfquery name="deletepractice" datasource="#ds#">
delete from psp_customDescriptions where recID = '#delete2#'
and procedureID = '#procedure#' and city = '#city#' and state='#state#'
</cfquery>
<cflocation url="cityEdit.cfm?recID=#recID#" addtoken="no">
</cfif>