Solved

Can coldfusion autosuggest work on a substring within a string

Posted on 2009-07-16
4
368 Views
Last Modified: 2013-12-24
I have a coldfusion autosuggest set up in my form on an artist name which works ok. Currently it lists all names that start with the first letters a user has typed in i.e. Typing in "Geo" lists George Catlin. What I'd like to have happen is search on either last name, first name or perhaps if the string is contained in what the user has typed in so if a user types in Catlin it will list George Catlin.



My code is below:
 
<cfinput type="text" name="ObjectNumber" autosuggest="cfc:collections.ObjectNumberLookup({cfautosuggestvalue})" size="20" maxlength="20" typeahead="yes"></p>
 
 
<cfargument name="Search" type="any" required="no" default="">
    	<!--- Define Variable --->
        <cfset var data = "">
        <cfquery NAME="data" datasource="education">
            SELECT artist_name FROM studentPodcasts WHERE (artist_name LIKE '#Arguments.Search#%')
        </cfquery>
 
		<cfreturn ValueList(data.artist_name)>
 
</cffunction>

Open in new window

0
Comment
Question by:cbeverly
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 19

Expert Comment

by:Jones911
ID: 24869767
Swap your query to this:

<cfquery NAME="data" datasource="education">
            SELECT   artist_name
            FROM      studentPodcasts
            WHERE   ( artist_name LIKE '%#Arguments.Search#%' )
</cfquery>
0
 

Author Comment

by:cbeverly
ID: 24869789
I tried that but unfortunately it didn't work.
0
 
LVL 19

Expert Comment

by:erikTsomik
ID: 24869828
well try this
(artist_name LIKE '#Arguments.Search#%' or artist_lastname LIKE '#Arguments.Search#%')
0
 
LVL 19

Accepted Solution

by:
Jones911 earned 500 total points
ID: 24869841
That will work I can't see how I wont.
0

Featured Post

Easy, flexible multimedia distribution & control

Coming soon!  Ideal for large-scale A/V applications, ATEN's VM3200 Modular Matrix Switch is an all-in-one solution that simplifies video wall integration. Easily customize display layouts to see what you want, how you want it in 4k.

Question has a verified solution.

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

Suggested Solutions

Hi, Even though I have created this Tutorial on My personal Blog, Some people might not able to find my website, So here i am posting it again Today, from the topic it is very clear that i will be showing you here the very basic usage of how we …
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.
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

730 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