Solved

Coldfusion Powered Bootstrap Typeahead

Posted on 2013-12-09
5
953 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Cold Fusion form reset button issues. 11 31
Timer on div 5 25
How can I use Javascript to insure proper entry of URL? 6 27
How do I post more than 1 item to php backend 24 32
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn how to dynamically set the form action using jQuery.
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)

726 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