Solved

Coldfusion Powered Bootstrap Typeahead

Posted on 2013-12-09
5
973 Views
Last Modified: 2013-12-12
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>
0
Comment
Question by:Bang-O-Matic
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 82

Expert Comment

by:leakim971
ID: 39707726
could you provide a link to a simple test page
0
 

Author Comment

by:Bang-O-Matic
ID: 39709080
Hi leakim971,

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

Thanks for your help!
0
 
LVL 16

Expert Comment

by:Gurpreet Singh Randhawa
ID: 39713240
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
0
 
LVL 16

Accepted Solution

by:
Gurpreet Singh Randhawa earned 500 total points
ID: 39713242
Like this

 var dataset = [<cfoutput>#quotedValueList(myquery.ciitiesName)#</cfoutput>];
0
 

Author Closing Comment

by:Bang-O-Matic
ID: 39714089
Works Perfectly! Thank you!
0

Featured Post

What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question