Solved

CFINPUT AutoSuggest not always working

Posted on 2011-03-25
5
743 Views
Last Modified: 2013-12-24
I have implemented a CFINPUT AutoSuggest but it seems to work with some keywords but not others.

For example, when I put in "educ" I get the following and the box of suggested values come up fine.  The ajax call return value is below.

["Art, Design & Culture > Film > Educational","Causes > Education","Education > Continuing Education","Art, Design & Culture > Film > Educational","Education"]

When I put in "cont" no suggested values come up but the ajax call return values have results as shown below.

["Art, Design & Culture > Fine Arts > Contemporary","Art, Design & Culture > Museums > Contemporary Art","Education > Continuing Education","Art, Design & Culture > Parks & Gardens > Dance > Contra Dancing"]

Can somebody tell me what is causing this strange intermittent behavior?

Thanks in advance.


<cfinput type="text" name="Categories" autosuggest="cfc:cfc.Activities.SearchCategoryDefinitions({cfautosuggestvalue})" autosuggestminlength="3" size="80" maxlength="256">

Open in new window

0
Comment
Question by:SFTProd
  • 3
  • 2
5 Comments
 
LVL 13

Expert Comment

by:srikanthmadishetti
ID: 35221947
paste ur SearchCategoryDefinitions function  code
0
 
LVL 13

Assisted Solution

by:srikanthmadishetti
srikanthmadishetti earned 500 total points
ID: 35221963

try testing like below

write your query here and keep

autosuggest="#ValueList(ur queryname.colmunname)#"


if you are getting it correctly then there is some problem in the cfc function which u are using.




0
 

Author Comment

by:SFTProd
ID: 35223406
The function is below.  The strange part is that it works for some keywords and does not for others.
<cffunction name="SearchCategoryDefinitions" access="remote" returntype="Array">
    <cfargument name="suggestvalue" required="true">
     
    <cfquery name="FetchCategories" datasource="JR_Main">
      SELECT ActivityCategoryDefinitionID 
	  FROM ActivityCategoryDefinitions
	  WHERE Name LIKE <cfqueryparam value="%#suggestvalue#%">
	</cfquery>	
		
    <cfset results = ArrayNew(1)>
	<cfloop query="FetchCategories">
	  <cfquery name="FetchCategoriesTree" datasource="JR_Main">
        SP_CategoryTree #ActivityCategoryDefinitionID#
	  </cfquery>  

	  <cfset arrayAppend(results, FetchCategoriesTree.Tree)>
	</cfloop>
        
	<cfreturn results>	
  </cffunction>

Open in new window

0
 

Accepted Solution

by:
SFTProd earned 0 total points
ID: 35356275
It turns out that autosuugest property for CFINPUT only shows values that match the characters already typed into the form and does not show all values in the feed by query.
0
 

Author Closing Comment

by:SFTProd
ID: 35381943
I figured it out myself.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is an updated version of a post made on my blog over 3 years ago. It is unfortunately, still very relevant as we continue to see both SQLi (SQL injection) and XSS (cross site scripting) attacks hitting some of the most recognizable website and …
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question