dfhuber2
asked on
problem with finding cfcomponent on cfselect bind
I have a file called allSchools.cfm that has the following snippet of code:
<cfselect name="selSchool"
bind="cfc:places.getSchool s({selStat e},{selCou nty})"
bindOnLoad="true"
display="facility_name" value="schoolID" />
I have a file called places.cfc in the same directory as allSchools.cfm that has the following code:
<cfcomponent>
<cffunction name="getSchools" returntype="query" output="false"
access="remote" hint="List all of the schools in the state and/or county">
<cfargument name="state" required="true" type="string">
<cfargument name="county" required="true" type="string">
<cfif (Compare(Trim(form.ARGUMEN TS.state), "Illinois") is 0) and
(Compare(Trim(ARGUMENTS.co unty), "Other") is not 0)>
<cfquery name="local.getSchools" datasource="#application.d atasource# ">>
SELECT schoolID, facility_name
FROM allSchools
WHERE county_name = <cfqueryparam value="#ARGUMENTS.county#" >
and state = 'IL'
ORDER BY facility_name
</cfquery>
<cfelse>
<cfquery name="local.getSchools" datasource="#application.d atasource# ">>
SELECT schoolID, facility_name
FROM allSchools
inner join states on allSchools.state = states.stateabbrev
WHERE statename = <cfqueryparam value="#ARGUMENTS.state#">
ORDER BY facility_name
</cfquery>
<cfreturn local.getSchools>
</cffunction>
</cfcomponent>
I am using ColdFusion 10 on a Windows IIS server.
I am getting the following error:
The specified CFC places could not be found.The path to the CFC must be specified as a full path, or as a relative path from the current template, without the use of mappings. The specific sequence of files included or processed is: D:\Web\xlc\addSchool.cfm, line: 130
What do I need to change to get it to find the cffunction?
<cfselect name="selSchool"
bind="cfc:places.getSchool
bindOnLoad="true"
display="facility_name" value="schoolID" />
I have a file called places.cfc in the same directory as allSchools.cfm that has the following code:
<cfcomponent>
<cffunction name="getSchools" returntype="query" output="false"
access="remote" hint="List all of the schools in the state and/or county">
<cfargument name="state" required="true" type="string">
<cfargument name="county" required="true" type="string">
<cfif (Compare(Trim(form.ARGUMEN
(Compare(Trim(ARGUMENTS.co
<cfquery name="local.getSchools" datasource="#application.d
SELECT schoolID, facility_name
FROM allSchools
WHERE county_name = <cfqueryparam value="#ARGUMENTS.county#"
and state = 'IL'
ORDER BY facility_name
</cfquery>
<cfelse>
<cfquery name="local.getSchools" datasource="#application.d
SELECT schoolID, facility_name
FROM allSchools
inner join states on allSchools.state = states.stateabbrev
WHERE statename = <cfqueryparam value="#ARGUMENTS.state#">
ORDER BY facility_name
</cfquery>
<cfreturn local.getSchools>
</cffunction>
</cfcomponent>
I am using ColdFusion 10 on a Windows IIS server.
I am getting the following error:
The specified CFC places could not be found.The path to the CFC must be specified as a full path, or as a relative path from the current template, without the use of mappings. The specific sequence of files included or processed is: D:\Web\xlc\addSchool.cfm, line: 130
What do I need to change to get it to find the cffunction?
Put places.cfc in your root folder
ASKER
I have placed copies in every directory now, and I still get the same error.
how about adding this code to see if it's found in your root folder...
<cfif fileExists('/places.cfc')>
its there
<cfelse>
not found
</cfif>
Maybe also check permissions on the file?
I'm a bit baffled too..
<cfif fileExists('/places.cfc')>
its there
<cfelse>
not found
</cfif>
Maybe also check permissions on the file?
I'm a bit baffled too..
Yeah, that is surprising. Are you 100% positive it's got a *.cfc extension? Do you get the same error if you try and create and instance of the component manually with cfinvoke?
<cfinvoke component="places.cfc" returnVariable="test">
or ... <cfinvoke component="/places.cfc" returnVariable="test">
EDIT: Also, since you mentioned IIS are there any virtual directories involved?
<cfinvoke component="places.cfc" returnVariable="test">
or ... <cfinvoke component="/places.cfc" returnVariable="test">
EDIT: Also, since you mentioned IIS are there any virtual directories involved?
ASKER
There are no virtual directories involved.
I will try both the <cfinvoke..... and multiple versions of the FileExists and let you know the results. I have several other <cfinvoke statements to another file/function that work fine and I even tried moving this <cffunction to that file and got the same result with the bind statement. So, it will be interesting to see what happens when trying this with the <cfinvoke. I am thinking it will work, but testing will be the final truth.
I will try both the <cfinvoke..... and multiple versions of the FileExists and let you know the results. I have several other <cfinvoke statements to another file/function that work fine and I even tried moving this <cffunction to that file and got the same result with the bind statement. So, it will be interesting to see what happens when trying this with the <cfinvoke. I am thinking it will work, but testing will be the final truth.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
The problem in finding it was due to the syntax error of missing the </cfif>. Once that was added, the problem of finding it was resolved.
The other was also an error, but was not part of the issue of finding the file/function
Thanks.
The other was also an error, but was not part of the issue of finding the file/function
Thanks.