7 Replies Latest reply on Mar 25, 2009 6:59 AM by thnguyen

    need help on CFcomponent

    thnguyen Level 1
      I have a CFC that use cfautosuggestvalue. here is the code

      <cfcomponent output="false">
      <cfset THIS.dsn="test">
      <!--- Lookup used for auto suggest --->
      <cffunction name="lookupArt" access="remote" returntype="array">
      <cfargument name="search" type="any" required="false" default="">
      <cfargument name="filters" type="any" required="false" default="">
      <!--- Define variables --->
      <cfset var data="">
      <cfset var result=ArrayNew(1)>
      <!--- Do search --->
      <cfquery datasource="#THIS.dsn#" name="data">
      FROM term_table
      WHERE term LIKE '#ARGUMENTS.search#%'
      AND distribution IN (#ARGUMENTS.filters#)
      ORDER BY term

      <!--- Build result array --->
      <cfloop query="data">
      <cfset ArrayAppend(result, term)>

      <!--- And return it --->
      <cfreturn result>

      My cfm page:
      <cfform action="index.cfm" method="post">
      <cfinvoke component="term" method="lookupArt" filters="#filters#" returnvariable="return_filters">
      <cfinput type="text"
      autosuggest="cfc:term.lookupArt({cfautosuggestvalue})" size="40" autosuggestminlength="2" />
      <cfinput type="submit" name="submit_search" value="Search" />

      the problem is that the filters variable passed over to the cfc but would not narrow the search term. I dont know how to get this to work?