Skip to main content
October 10, 2013
Question

auto-completed

  • October 10, 2013
  • 0 replies
  • 333 views

    I am not sure how to do it.  I have the augosugess working fine from the first input field.  When i start enter the name into this box, i want other information automatic to  populate into other text boxses as well  like company , descp for this name.  Can some some pleae help?

<cffunction name="lookupItem" access="remote" returntype="array">

    <cfargument name="search" type="any" required="false" default="">

       

        <!--- Define variables --->

        <cfset var qArt="">

        <cfset var result=ArrayNew(1)>

       

        <!--- Do search --->

      <cfquery name="qArt" datasource="art">

          select * from [dbo].[arts]

         WHERE Artname LIKE '#ARGUMENTS.search#%'

        </cfquery>

       

        <!--- Build result array --->

        <cfloop query="qArt">

       <cfset ArrayAppend(result, Artname)>

   

        </cfloop>

       

                <!--- And return it --->

        <cfreturn result>

    </cffunction>

   

   

    <cfform action="" method="post" name="medform">

    <cfinput autosuggest="cfc:cfc.Art.lookupItem({cfautosuggestvalue})" type="text" name="Artname" size="30" typeahead="yes">

   

  

    Name<cfinput type="text" name="desc" label="desc" bind="{Artname}" ><br>

   

    Comp:<cfinput type="text" id="comp" name="comp" label="conp" bind="cfc:cfc.Art.lookupItem({Artname})" >

   

    Desc:<cfinput type="text" id="desc" name="desc" label="desc" bind="cfc:cfc.Art.lookupItem({Artname})" >

    </cfform>

    This topic has been closed for replies.