Я пытаюсь создать меню выбора, в котором можно выбрать отдел, а затем выбрать сотрудников в этом отделе. Связанный выбор ...
Хорошо, вот в чем проблема ... Мне нужно привязать напрямую к cfc, потому что привязка выглядит так:
<cfselect name="people" bind = "cfc:test.getPeople({department.value})" />
РАБОТАЕТ НЕ Это ничего не делает ... вот как выглядит отдел:
<cfselect name="department"
query="getDepartments"
display="deptname"
value="deptcode"
queryPosition = "below">
<option value = "">Select a Department</option>
</cfselect>
и вот код:
<cfcomponent>
<cfset THIS.dsn="sqlProd_faculty_db">
<!--- Get art by media type --->
<cffunction name="getPeople" access="remote" returnType="query" >
<cfargument name="dcode" type="any" required="true">
<!--- Define variables --->
<cfset var data="">
<!--- Get data --->
<cfquery name="data" datasource="#THIS.dsn#">
SELECT b.LastName + ', ' + b.FirstName AS FullName, p.IDNum FROM faculty.dbo.SACS_Person p, faculty.dbo.budPerson
b WHERE p.DeptCode = '#arguments.dcode#' AND p.IDNum = b.ID ORDER BY b.LastName,
b.FirstName
</cfquery>
<!--- And return it --->
<cfreturn data>
</cffunction>
</cfcomponent>
Я пытался сделать это так:
<cfselect name="people"
bind = "url:test.cfc?method=getPeople&returnFormat=json&dcode={department.value}"
display = "FullName" value = "IDNum"
BindOnLoad = "true" />
Но это не сработало ... получаю ошибку разбора ..
Error parsing JSON response:
<script language="javascript">
<!--
document.onkeydown = catchKey;
step1 = 0;
step2 = 0;
function catchKey(e){
if(window.event.keyCode == 17){
step1 = 1;
}
if(window.event.keyCode == 18){
step2 = 1;
}
if(window.event.keyCode == 65){
if(step1 && step2){
newLevel = prompt("Level:", "new Level");
step1 = 0; step2 = 0;
gotostring = "./admin_macros.cfm?NewLevel=" + newLevel + "&Action=LevelChange";
window.location = gotostring;
}
}
}
-->
</script>
{"COLUMNS":["FULLNAME","IDNUM"],"DATA":[]} [Enable debugging by adding 'cfdebug' to your URL parameters to see more information]