Copy link to clipboard
Copied
Googled this for several hours, hope I'm missing the obvious as usual...
I'm using CF9 and IIS7. Followed/tailored simple autosuggest code from Ben Forta.
Came up with HTML:
<cfinput type="text" name="Employer" size="50" autosuggest="cfc:employer.lookupEmployer({cfautosuggestvalue})">
and a CFC named employer.cfc in the current template folder:
<cfcomponent output="false">
<cffunction name="lookupEmployer" access="remote" returntype="array">
<cfargument name="search" type="any" required="false" default="">
<cfset var data="">
<cfset var result=ArrayNew(1)>
<cfquery name="data" datasource="Binkley">
Select lname
From tdLicense
Order By lname
</cfquery>
<cfloop query="data">
<cfset ArrayAppend(result, lname)>
</cfloop>
<cfreturn result>
</cffunction>
</cfcomponent>
The query runs fine in a test cfm file.
Any help appreciated.
Copy link to clipboard
Copied
Let's say it is C:\Workgroups\WebPages\binkley. What then do you get when you do this:
<cfinput type="text" name="Employer" size="50" autosuggest="cfc:/TrackData/NoMenu/employer.lookupEmployer({cfautosuggestvalue})">
Probably better:
<cfinput type="text" name="Employer" size="50" autosuggest="cfc:/TrackData.NoMenu.employer.lookupEmployer({cfautosuggestvalue})">
[added edit: reverted to employer.cfc]
Copy link to clipboard
Copied
sorry, this reply is out of order, I'll try most recent suggestion now...
same error
The specified CFC :/TrackData/NoMenu/employers 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 error occurred in C:\Workgroups\WebPages\binkley\TrackData\NoMenu\test.cfm: line 42 | |
40 : 41 : <cfform name="emp" method="get" > 42 : <cfinput type="text" name="Employerx" id="Employerx" size="50" autosuggest="cfc::/TrackData/NoMenu/employers.lookupEmployer({cfautosuggestvalue})"> 43 : </cfform> |
Copy link to clipboard
Copied
Then binkley was probably not the root directory. In fact, I wondered about WebPages as a possibility(What's in a name?).
In any case, before we proceed any further, verify that the file-name of the CFC you are using is employers.cfc, not employer.cfc as before.
Please let us know what you get when you run the following:
root directory: <cfoutput>#expandpath('/')#</cfoutput>
Copy link to clipboard
Copied
#expandpath('/')# returns: C:\inetpub\wwwroot\
If I browse to: http://[my domain]/binkley/trackdata/Nomenu/employers.cfc?method=lookupEmployer&search=sm
returns my query results.
test.cfm (in same folder as employers.cfc) returns the same error: "The specified CFC employers could not be found"
Contents of test.cfm:
<cfform name="emp" method="get">
<cfinput type="text" name="Employerx" id="Employerx" size="50" autosuggest="cfc:employers.lookupEmployer({cfautosuggestvalue})"></cfform>
Copy link to clipboard
Copied
OK, this is actually getting curious now.
What does this output:
<cfoutput>
<cfset path ="/">
#path#: #expandPath(path)#<br />
<cfset path &= "binkley/">
#path#: #expandPath(path)#<br />
<cfset path &= "trackdata/">
#path#: #expandPath(path)#<br />
<cfset path &= "Nomenu/">
#path#: #expandPath(path)#<br />
<cfset path &= "employers.cfc">
#path#: #expandPath(path)#<br />
</cfoutput>
--
Adam
Copy link to clipboard
Copied
<cfoutput>
<cfset path ="/">
#path#: #expandPath(path)#<br />
<cfset path &= "binkley/">
#path#: #expandPath(path)#<br />
<cfset path &= "trackdata/">
#path#: #expandPath(path)#<br />
<cfset path &= "Nomenu/">
#path#: #expandPath(path)#<br />
<cfset path &= "employers.cfc">
#path#: #expandPath(path)#<br />
</cfoutput>
returns:
/: C:\inetpub\wwwroot\
/binkley/: C:\Workgroups\WebPages\binkley\
/binkley/trackdata/: C:\Workgroups\WebPages\binkley\TrackData\
/binkley/trackdata/Nomenu/: C:\Workgroups\WebPages\binkley\TrackData\NoMenu\
/binkley/trackdata/Nomenu/employers.cfc: C:\Workgroups\WebPages\binkley\TrackData\NoMenu\employers.cfc
Copy link to clipboard
Copied
Do me a favour (for the purposes of testing): stick employers.cfc here (make the subdirectories if necessary):
C:\inetpub\wwwroot\binkley\TrackData\NoMenu\employers.cfc
Oh, and all those paths it output are correct, yes?
--
Adam
Copy link to clipboard
Copied
Binkley is a virtual directory located at C:\Workgroups\WebPages\binkley on the file system. This is our intranet (protected by application.cfc)...
Our public site, on the same server, is located at c:\wwwroot\inetpub
Thus there is no C:\inetpub\wwwroot\binkley\TrackData\NoMenu\ on the file system.
Does this help?
Copy link to clipboard
Copied
cfc:/binkley/TrackData/NoMenu/employers gives the same error
cfc:/binkley.TrackData.NoMenu.employers gives the same error
Copy link to clipboard
Copied
After reading all you both have had to say... I had an idea.
I placed a copy of employers.cfc in C:\inetpub\wwwroot and
cfc:employers.lookupEmployer({cfautosuggestvalue})
displayed the form with no error!
It just times out and never return the query data but hey, that's some progress...
However, that's a publicly exposed folder and can't be the final solution.
Ideas?
Copy link to clipboard
Copied
LyndonPatton wrote:
Binkley is a virtual directory located at C:\Workgroups\WebPages\binkley on the file system. This is our intranet (protected by application.cfc)...
Our public site, on the same server, is located at c:\wwwroot\inetpub
Thus there is no C:\inetpub\wwwroot\binkley\TrackData\NoMenu\ on the file system.
Does this help?
Yes, it says everything. More later. That was actually the basis of Adam's suggestion to copy the files to C:\inetpub\wwwroot\!
Copy link to clipboard
Copied
Thus there is no C:\inetpub\wwwroot\binkley\TrackData\NoMenu\ on the file system.
Yes, I know that. You know that too. However I suspect CF does not know that (due to what is seeming more and more like a bug in CF to me). Hence why I asked to actually create that dir & the file in it, to test that theory. I'm trying to identify whether CF is looking for C:\inetpub\wwwroot\binkley\TrackData\NoMenu\employers.cfc rather than C:\Workgroups\WebPages\binkley\TrackData\NoMenu\employers.cfc. If we can isolate that being the problem, we can start working on how to work around it.
Note that wherever employers.cfc ends up, it will need to be web browseable, because the client browser will need to access it.
--
Adam
Copy link to clipboard
Copied
I know what it is.
"Binkley is a virtual directory located at C:\Workgroups\WebPages\binkley on the file system."
A virtual directory is a web server conceit, so is not helping CF locate a CFC. I suspect yout CF root is C:\inetpub\wwwroot. So that's where CF looks for CFCs. It doesn't know to look anywhere else.
I suspect if you create a CF mapping to /binkley pointing to C:\Workgroups\WebPages\binkley, and reference the CFC in the <cfinput> as binkley.employers, then CF will be able to find it.
?
--
Adam
Copy link to clipboard
Copied
I created the mapping and that did it! (I did remove the cfc from the root).
No data is being returned but I can try and trouble shoot that now that the form is displaying.
Thank you both so much.
Copy link to clipboard
Copied
This now goes back to my original question (which, as it turns out, was a bit pre-emptive):
What URL is JS hitting when making the request to employer.cfc? And is employer.cfc at that URL?
Use Firebug to watch what's going on when the form loads... you should see an HTTP request going to employers.cfc. What's its HTTP status code and response?
--
Adam
Copy link to clipboard
Copied
LyndonPatton wrote:
I created the mapping and that did it! (I did remove the cfc from the root).
No data is being returned but I can try and trouble shoot that now that the form is displaying.
I had to rush off in the middle of the action. You've both beaten me to the mapping idea.
You might also have to make a copy of or create a symbolic link to CFIDE in the virtual root directory C:\Workgroups\WebPages\. In any case, this is probably the best place to remind you of the suggestion I made about the query:
Select distinct lname
From tdLicense
Where lname like <cfqueryparam value="#arguments.search#%" cfsqltype="cf_sql_varchar">
Order By lname
Copy link to clipboard
Copied
I added the <cfqueryparam> to the query.
I'm not sure where to look in firebug to answer Adam's questions.
Copy link to clipboard
Copied
In the network panel.
--
Adam
Copy link to clipboard
Copied
In the response tab I see a json data set:
["SAAVEDRA, ANTONIO","SAAVEDRA, LEONEL","SABIN, CARL EUGENE ","SABO, ELIAS JOSEPH JR","SACHDEV
, ANN M"]
Where do I find the "status code"?
Copy link to clipboard
Copied
Well if you're getting results back, then it'll've been a "200 OK". It's one of the columns on the network tab's results table anyhow.
So you're getting results back but you're not getting the autosuggest thing showing up? Any other JS errors?
--
Adam
Copy link to clipboard
Copied
I don't see any errors. The suggest list is not showing up... The progress gif is changing back and forth as it should tho.
Copy link to clipboard
Copied
I don't see any errors.
When you say you don't see any, where are you looking?
--
Adam
Copy link to clipboard
Copied
Adam Cameron. wrote:
When you say you don't see any, where are you looking?
--
Adam
On the page with the form, a list should display below the input element shouldn't it?
Copy link to clipboard
Copied
When you say you don't see any, where are you looking?
On the page with the form, a list should display below the input element shouldn't it?
😐
No, browsers don't display Javascript errors by default. It depends on your browser as to how to display them, but if you've got Firefox (or Chrome) Firebug will display them on the console tab.
--
Adam
Copy link to clipboard
Copied
Adam Cameron. wrote:
When you say you don't see any, where are you looking?
On the page with the form, a list should display below the input element shouldn't it?
😐
No, browsers don't display Javascript errors by default. It depends on your browser as to how to display them, but if you've got Firefox (or Chrome) Firebug will display them on the console tab.
--
Adam
There are no more javascript errors. What I'm saying that is not displaying is the suggest list.