cf challenge - make a cf8 cfinput autosuggest work - easy? simple?

I've been all over the internet with no solution. Lot's of rediculous blogs. Others have asked and not received an answer. I'm coming to the "pros". The guys who LIKE to answer questions. Don't fail me now.

Use the following code to start. Change it any way you like. I will take the changed code and test it. If it doesn't work for me, you have to help me find out why. This could be frustrating, I know.

<cfajaximport tags="CFINPUT-AUTOSUGGEST">
<div align="center">
<cfform name="CompSearch" format="html">
<table>
  <tr>
        <td>Company:</td>
    <td><cfinput type="text" name="name" size="30" autosuggest="cfc:cfc.basic.lookupCompany({cfautosuggestvalue})"></td>
  </tr>
</table>  
</cfform>
</div>



      <cffunction name="lookupCompany" access="remote" returntype="query" returnformat="json">
        <cfargument name="search" type="any" required="false" default="">
    <cfset var data="">
    <cfquery datasource="#request.dsn#" name="data">
                  SELECT name
                   FROM companies
      <cfif not arguments.search eq "">WHERE name LIKE '#ARGUMENTS.search#%'</cfif>
      ORDER BY name
    </cfquery>
        <cfreturn data>
      </cffunction>


The goal is simple. Make this autosuggest work.
LVL 1
larksysAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

PluckaCommented:
Have you seen this

http://tutorial7.learncf.com/
0
larksysAuthor Commented:
You're in or you're out. Make up your mind.
0
larksysAuthor Commented:
I'm using the following url to test.

http://tax.avericom.com/control/companies/vaughn.cfm
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

PluckaCommented:
What are you talking about, the code example I posted is an exact working example of what you want. What more do you want exactly since we don't have your database.
0
PluckaCommented:
Ok, I'll humor you

http://code.fraser.id.au/vaughn.cfm

This works perfectly. There are two problems with yours that I had to fix other than use different datasource etc.

First the function return type must be String

Second you need to return using the valueList function.

Both of this is demonstrated in that link I sent you

PS: You need to type in uppercase as I didn't want to change much of your code and the sample db is case sensitive.

Working code posted below. What do I win?
vaughn.cfm
<cfajaximport tags="CFINPUT-AUTOSUGGEST">
<div align="center">
<cfform name="CompSearch" format="html">
<table>
  <tr>
        <td>Company:</td>
    <td><cfinput type="text" name="name" size="30" autosuggest="cfc:vaughn.lookupCompany({cfautosuggestvalue})"></td>
  </tr>
</table>  
</cfform>
</div>
 
vaughn.cfc
<cffunction name="lookupCompany" access="remote" returntype="string" returnformat="json">
    <cfargument name="search" type="any" required="false" default="">
 
    <cfset var data="">
 
    <cfquery datasource="cfdocexamples" name="data">
        SELECT parkname
        FROM parks
        <cfif not arguments.search eq "">WHERE parkname LIKE '#ARGUMENTS.search#%'</cfif>
        ORDER BY parkname
    </cfquery>
 
    <cfreturn valueList(data.parkname) />
</cffunction>

Open in new window

0
PluckaCommented:
There is stuff in this code that I didn't change to make it as similar as yours as possible that is not needed, if you get it working and want to simplify it, let me know.
0
larksysAuthor Commented:
Here is the cfc function with the 2 changes.

      <cffunction name="lookupCompany" access="remote" returntype="string" returnformat="json">
        <cfargument name="search" type="any" required="false" default="">
    <cfset var data="">
    <cfquery datasource="#request.dsn#" name="data">
                  SELECT name
                   FROM companies
      <cfif not arguments.search eq "">WHERE name LIKE '#ARGUMENTS.search#%'</cfif>
      ORDER BY name
    </cfquery>
        <cfreturn valueList(data.name)>
      </cffunction>

I you go to the url above and use "her" you should get at least 3 responses. If I move the query to the cfm page it will work. Change anything you like. I will test it.
0
PluckaCommented:
its throwing a JS error. Can you do a test page that has none of that JS menu to see if that is conflicting?
0
larksysAuthor Commented:
Good catch, by the way.
0
larksysAuthor Commented:
if you go to http://tax.avericom.com/control/companies/vaughn2.cfm you will see the following code work;

<cfajaximport tags="CFINPUT-AUTOSUGGEST">

<div align="center">
<cfform name="CompSearch" format="html">
    <cfquery datasource="#request.dsn#" name="data">
                  SELECT name
                   FROM companies
      ORDER BY name
    </cfquery>
<table>
  <tr>
        <td>Company:</td>
    <td><cfinput type="text" name="name" size="30" autosuggest="#ValueList(data.name)#"></td>
  </tr>
</table>  
</cfform>
</div>
0
larksysAuthor Commented:
I've taken out as much as I can find. The original design was by someone else. Still looking.
0
PluckaCommented:
Thats worse, gets an error before I even do anthing.

Cant you just do a simple test page with just the code I pasted or your version of it.
0
larksysAuthor Commented:
I suspect part of the problem IS the site. But, I will do what I can.
0
larksysAuthor Commented:
A "clean site" is http://www.taxtalent.com/vaughn/vaughn.cfm and the code works. There's the rub. Why doesn't it work on the other site?
0
larksysAuthor Commented:
I've compared everything I can find on the 2 servers. There are only minor differences. Except the one major difference - cfgrid and cfautosuggest. Anyone care to take a stab at making the code work? Spry widgets like tabbed panels work just fine.
0
PluckaCommented:
As I said before if it works without the menu and not with it, there is a javascript conflict between the libraries.

I think you would be better asking for help with that in a JavaScript topic area.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ColdFusion Language

From novice to tech pro — start learning today.