3 Replies Latest reply on Jul 29, 2013 10:02 AM by vishu#13





      I have two questions, hope anyone can assist me with?

      1) I have the drop box is displayed the long list of city names and don't want user to scroll up and down to find the name.  Is there the way we can do autosuggest like on the cfinput tag to narrow down the list in cfselect?

      2 )
      <cfinput type="text" name="city" autosuggest="cfc:cfc.city.lookupName({cfautosuggestvalue})">
      It works fine with autosuggest, but we can only search for one name, is there the way to search for mutitples?.  For example, if I star enter A in the text box, then it shows Arlington, Angleton,Alvin ..I want to be able to select both Arlington and  Angleton and pass them into arguments?


        • 1. Re: autosuggest
          vishu#13 Level 3



          Create a .cfc name it as autosuggest.cfc


          <cfcomponent output="false">


              <!--- Lookup used for auto suggest --->

              <cffunction name="findPark" access="remote" returntype="string">

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


                  <!--- Define variables --->

                  <cfset var local = {} />


                  <!--- Query Location Table --->

                  <cfquery name="local.query" datasource="cfdocexamples" >

                      select        parkname

                      from        parks

                      where        parkname like <cfqueryparam cfsqltype="cf_sql_varchar" value="#ucase(arguments.search)#%" />

                      order by    parkname



                  <!--- And return it as a List --->

                  <cfreturn valueList(local.query.parkname)>






          Now create a.cfm and name as demo.cfm


          <!--- A simple form for auto suggest --->

          <cfform action="autosuggest.cfm" method="post">

              Park Name:<br />

              <cfinput type="text" name="parkname" size="50" autosuggest="cfc:autosuggest.findPark({cfautosuggestvalue})" autosuggestminlength="1" maxresultsdisplayed="10" /><br /><br />




          Place both of them in the webroot and run demo.cfm, you will get exactly the same results which you are looking for.


          Hope it helps




          • 2. Re: autosuggest
            newcf Level 1

            yes it worked fine, but my question is can we do the same for text area instead of input filed?  OR can we select mutiple values from the autolist for input field?



            • 3. Re: autosuggest
              vishu#13 Level 3

              I don't think so you can achieve the same for text area however I am not sure as I havenot used it.