Skip to main content
Known Participant
September 12, 2013
Answered

passing multiple parms in autosuggest

  • September 12, 2013
  • 1 reply
  • 860 views

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 has been closed for replies.
    Correct answer Carl Von Stetten

    Near the very end of the <cfinput> line:

    {variables.co mpID}

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

    -Carl V.

    1 reply

    Carl Von Stetten
    Legend
    September 12, 2013

    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.

    newcfAuthor
    Known Participant
    September 12, 2013

    humm, where,i did not see it?

    Carl Von Stetten
    Carl Von StettenCorrect answer
    Legend
    September 12, 2013

    Near the very end of the <cfinput> line:

    {variables.co mpID}

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

    -Carl V.