Copy link to clipboard
Copied
Good morning everyone! I am in the process of testing out my code after upgrade from CF 9 to CF 11 update 7, so far things are going quite well except for one feature that was not built by me for our intranet page- The feature is a quick search button that allows users to type and get auto suggest options- For example typing Form would bring up anything in out links database that has the word form in it. This works perfectly on CF9, on CF11 it works ( no errors) except for the query only pulls based on the first letter typed For Example previously I could type Interview and I would get multiple results with the word interview in it, now i type and i only get results that start with matching letters. Below is a screen show that may make more sense as well as part of our code- I have verfied in SQL mgm studio that the query outputs the correct information- I also ran code analyzer on this page and it came back with no issues
Also during the upgrade i exported the .car file from cf 9 into cf 11 so the settings should be the same- also like i said before it is not throwing errors- it works- just not with the fully correct results- my apologies if the code is not up to par- like i said i didn't write this!
CODE OUTPUT of CFC File
<cfcomponent>
<cfset ds="IntranetLinks">
<!--- Function to get the web pages from the database. Used for the Auto-Suggest --->
<cffunction name="lookupLink"
access="remote"
returntype="String"
hint="Lookup method for Ajax auto-suggest">
<cfargument name="search"
type="any"
required="false"
default="">
<cfset var data="">
<cfquery datasource="#ds#" name="data">
SELECT PageName
FROM dbo.links
WHERE UPPER(PageName) LIKE UPPER('%#ARGUMENTS.search#%')
ORDER BY PageName
</cfquery>
<cfreturn ValueList(data.PageName)>
</cffunction>
<!--- Function to get the URL from the database. Populates the hidden text box on the page and used in Javascript to go to the uRL --->
<cffunction name="GetURL"
access="remote"
returntype="String"
hint="Gets URL of Page - used for binding">
<cfargument name="search"
type="any"
required="false"
default="">
<cfset var data="">
<cfquery datasource="#ds#" name="data">
SELECT URL, PageName
FROM dbo.links
WHERE UPPER(PageName) LIKE UPPER('%#ARGUMENTS.search#%')
ORDER BY URL
</cfquery>
<cfreturn data.URL>
</cffunction>
</cfcomponent>
Copy link to clipboard
Copied
Hi, brianc6331257‌,
The code looks solid, to me. But the CF11 results that you describe - it's as if the database is ignoring the first wildcard.
Have you searched the Adobe bugbase to see if something like this has been posted? I can't think of anything that would cause this. Not even in CFAdmin.
V/r,
^_^
Copy link to clipboard
Copied
Thats what my gut says to, ill have to look through the bugbase and see if i can find anything
Thank you for your input!
Copy link to clipboard
Copied
If i use this code to simulate the query in my page : <cfquery datasource="Links" name="data">
SELECT PageName
FROM dbo.IntranetUpdated
WHERE UPPER(PageName) LIKE UPPER('%Form%')
ORDER BY PageName
</cfquery>
<cfoutput query="data" >
#PageName#
</cfoutput>
I get an output of :
Risk Downtime Form 2015 Plan Information 901 Upgrade Information Appeal Form Authorization for Disclosure of Protected Health Information Benefits Information CarePoints Information Drug Information Service Emergency Department Forms Employee Mammogram Form ESA REMS Form Exit Interview Information Exposure Forms Non-Associate FDA MedWatch Voluntary Reporting Form Health Information Release Form Hospital Forms Hospital Formulary - Formulary Kronos System Access Form Leave/Disability Information For Employees Non-Grandfathered Healthcare Reform Preventive Services Order Form - Administrative Order Form - Clinical Order Form - Physical Therapy Order Uniforms Performance Manager Pt Relations Downtime Form Registration Information Resident City Tax Form Scheduling Change Form Scheduling Encumbrance Form Seidman Forms Standards of Performance W9 Form
This is correct as these are all the documents with the word form in it- If i go back to the page that uses arguments.search and type the word form- i get no results
So this leads me to believe it is not the wildcards-but possible the arguements.search
Copy link to clipboard
Copied
On the page where you call this CFC, can you dump the FORM scope and make sure the value being passed to the CFC method is correct?
Also, and this may not help but would be a good idea from a security standpoint - use <cfqueryparam> to pass the argument in your SQL statements.
Copy link to clipboard
Copied
It does that with 'form'; but your first example used 'interv'. If you ran the same experiment, are the results the same? Probably, but I'm OCD enough to run it with the original attempted word.
But, really, that's neither here nor there. The issue is happening in real time, as you are typing into the input field. So, as annoying as this will be - before the function returns the results, set up a CFMAIL (spoolenabled, and type="html") that will contain a dump of what the function is getting from the database. Yeah, you'll probably get, like, 50 or more emails, but that will show what the function is GETTING. Then, do the same thing on the page that is displaying the options in the input. That will show what the page is RECEIVING from the function. If they don't match, somewhere therein lies the culprit.
Just my thot.
V/r,
^_^