Skip to main content
Known Participant
Sep 12, 2013 4:28 PM UTC
Answered

passing multiple parms in autosuggest

Hi,

please help, i can't figure out

The variables.compID is numeric but with this code below, i have an error: "the CompID argument passed to the getItem function is not type numeric".  I then change it to

<cfargument name="compID" type="any" required="yes" > for testing and then got the diffrent error: The Element compID is undefined in arguments

Can any one tell me why? thanks

<!---cfm--->
<cfset variables.compID = request.state.compID />

<cfinput type="text" name="name" size="30" id="name" value="" autosuggest="cfc:cfc.query.getItem({cfautosuggestvalue},{variables.compID})"/>

<!---cfc--->
<cffunction name="getItem" access="remote" returntype="Array" >
  <cfargument name="search" type="any" required="false"/>
  <cfargument name="compID" type="numeric" required="yes" >
       
  <cfdump var="#arguments.compID#" >

<!--- Define variables --->
  <cfset var qItem="">
   <cfset var result = "">
 
 
  <!--- Do search --->
  <cfquery name="qName" datasource="#dsn#" >
  select name, id from mytbl#arguments.compID#
  WHERE  name LIKE lower('#ARGUMENTS.search#%')
  ORDER BY name
  </cfquery>
 
  <!--- Build result array --->
  <cfloop query="qName">
  <cfset ArrayAppend(result, name)>
 
  </cfloop>

 
 
<cfreturn result>
  </cffunction>
 

    This topic is closed to new replies. Start a new post to keep the conversation going.
    Carl Von Stetten
    Carl Von StettenCorrect answer
    Legend
    Sep 12, 2013 5:56 PM UTC

    Near the very end of the <cfinput> line:

    {variables.co mpID}

    Note the space between "variables.co" and "mpID".

    -Carl V.

    4 replies

    Carl Von Stetten
    Legend
    Sep 12, 2013 5:44 PM UTC

    You have a space in the variable name at the end of your <cfinput> tag.  Is that just a typo on the forum, or is that space present in your code?

    -Carl V.

    Translate
    newcfAuthor
    Known Participant
    Sep 12, 2013 5:52 PM UTC

    humm, where,i did not see it?

    Translate
    Carl Von Stetten
    Carl Von StettenCorrect answer
    Legend
    Sep 12, 2013 5:56 PM UTC

    Near the very end of the <cfinput> line:

    {variables.co mpID}

    Note the space between "variables.co" and "mpID".

    -Carl V.

    Translate