• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

cfinput autosuggest

Explorer ,
Oct 15, 2007 Oct 15, 2007

Copy link to clipboard

Copied

I'm a little frustrated with CF8 and the new Spry functions. I'm trying to convert my old autosuggests to the cfinput and binding with a function in a cfc. I'm trying to follow the examples but getting the following error;

Error invoking CFC /components/tsijobads cfc. Internal server error (enable debugging .......)

The code is;

<cffunction name="getCompanies" access="remote" returntype="array" output="false" description="Returns submission titles">
<cfargument name="term" type="string" required="true">
<cfset var CnameQry = "">
<cfquery name="CnameQry" datasource="AS400" dbtype="ODBC" maxrows="50">
SELECT rtrim(ltrim(csnam1)) as cname, rtrim(ltrim(csstat)) as state, rtrim(ltrim(cscity)) as city, csrec## as companyid
FROM cstatic
WHERE UPPER(csnam1) LIKE <cfqueryparam cfsqltype="cf_sql_varchar" value="#ucase(left(arguments.term,255))#%">
order by csnam1,cscity
</cfquery>
<!--- Build result array --->
<cfset Carray = listotarray(CnameAry.csnam1)>

<cfreturn Carray>

</cffunction>



<cfinput name="sfCname#counter#" id="sfCname#counter#" autosuggest="cfc:400comps.tsijobads.getCompanies({cfautosuggestvalue})" maxResultsDisplay="50">
TOPICS
Advanced techniques

Views

653

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 15, 2007 Oct 15, 2007

Copy link to clipboard

Copied

larksys wrote:

> Error invoking CFC /components/tsijobads cfc. Internal server error (enable
> debugging .......)

> <cfinput name="sfCname#counter#" id="sfCname#counter#"
> autosuggest="cfc:400comps.tsijobads.getCompanies({cfautosuggestvalue})"
> maxResultsDisplay="50">
>

your error says your cfc is in /components/tsijobads
your cfinput bind says it is in 400comps.tsijobads

either on of them is a typo or you are trying to use a mapped cf folder,
which is not allowed with ajax calls.

--

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 16, 2007 Oct 16, 2007

Copy link to clipboard

Copied

This code works;

<cfinput name="sfCname#counter#" id="sfCname#counter#" size="40" autosuggest="cfc:400comps.tsijobads.getCompanies({cfautosuggestvalue})" maxResultsDisplay="50">

<cffunction name="getCompanies" access="remote" returntype="string">
<cfargument name="term" type="any" required="false" default="">
<cfset var CnameQry = "">
<cfquery name="CnameQry" datasource="AS400" dbtype="ODBC" maxrows="50">
SELECT rtrim(ltrim(csnam1)) as cname, rtrim(ltrim(csstat)) as state, rtrim(ltrim(cscity)) as city, csrec## as companyid
FROM cstatic
WHERE UPPER(csnam1) LIKE <cfqueryparam cfsqltype="cf_sql_varchar" value="#ucase(left(arguments.term,255))#%">
order by csnam1,cscity
</cfquery>
<cfreturn ValueList(CnameQry.cname)>
</cffunction>

---------------------------------------------------------------------------------------------------
This code does not;

<cfinput type="text" name="sfiname#counter#" id="sfiname#counter#" autosuggest="cfc:400comps.tsijobads.getIndividualsH({cfautosuggestvalue})" maxResultsDisplay="50">

<cffunction name="getIndividualsH" access="remote" returntype="string">
<cfargument name="term" type="any" required="false" default="">
<cfset var IndivQry = "">
<cfquery name="IndivQry" datasource="AS400" dbtype="ODBC" maxrows="50">
SELECT rtrim(ltrim(isfnam)) as FNAME, rtrim(ltrim(islnam)) as LNAME, rtrim(ltrim(istitl)) as ITITLE, iswfon as WPHONE, isrec## as RECNUM
FROM istatic
WHERE UPPER(islnam) LIKE <cfqueryparam cfsqltype="cf_sql_varchar" value="#ucase(left(arguments.term,255))#%">
ORDER by islnam,isfnam
</cfquery>
<cfreturn ValueList(IndivQry.isfnam)>
</cffunction>

----------------------------------------------------------------------------------------------------
I don't think the mapped folder is the problem. I solved part of the problem by changing the function output type to "string" and returning a list. Some of the examples and cfml ref are just plain wrong. Hard to believe, huh.

I just noticed that I have a type of "text" on one cfinput and not the other. I just tested it without "text" and it didn't make a difference.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 17, 2007 Oct 17, 2007

Copy link to clipboard

Copied

LATEST
Started from scratch using cfinput and autosuggest. It works fine. I just can't find the error in the above code.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation