?
Solved

Can coldfusion autosuggest work on a substring within a string

Posted on 2009-07-16
4
Medium Priority
?
372 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 2000 total points
ID: 24869841
That will work I can't see how I wont.
0

Featured Post

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

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

Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses
Course of the Month15 days, 4 hours left to enroll

771 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