Avatar of Dusty
Dusty
Flag for United States of America asked on

Coldfusion Powered Bootstrap Typeahead

Since I can't use coldfusion "autosuggest" with Railo, I need help in getting this to work with bootstrap typeahead and any help is appreciated!

The following is example code that works but is not dynamic. I need to integrate the query below.

------------------
<input
                    type="text"
                    class="span4 basicTypeahead"
                    placeholder="What's your favorite US State?"
                    autocomplete="off"
                    data-provide="typeahead"
                />

Open in new window


How can I get the results of a cfquery to populate the bootstrap typeahead? Code examples appreciated!
 <script type="text/javascript">
        var dataset = ['Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California', 'Colorado', 'Connecticut', 'Delaware', 'District of Columbia', 'Florida'];
        $(function(){
            $(".basicTypeahead").typeahead({
                source: dataset
                ,items: 10
            });
        });
    </script>

Open in new window



My query

      <cfquery datasource="myds" name="data">
            SELECT ID
            FROM res
            WHERE Trim(ID) LIKE Trim('#ARGUMENTS.search#%')
            ORDER BY ID
      </cfquery>
ColdFusion LanguageJavaScriptjQuery

Avatar of undefined
Last Comment
Dusty

8/22/2022 - Mon
leakim971

could you provide a link to a simple test page
Dusty

ASKER
Hi leakim971,

Here is a link to test page    http://macongahomes.com/test2.cfm

Thanks for your help!
Coast Line

in your dataset, store the results of the query using a valuelist function, it will give you comma separated values and then you can use them
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
ASKER CERTIFIED SOLUTION
Coast Line

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Dusty

ASKER
Works Perfectly! Thank you!