• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1029
  • Last Modified:

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>
0
Bang-O-Matic
Asked:
Bang-O-Matic
  • 2
  • 2
1 Solution
 
leakim971PluritechnicianCommented:
could you provide a link to a simple test page
0
 
Bang-O-MaticAuthor Commented:
Hi leakim971,

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

Thanks for your help!
0
 
Gurpreet Singh RandhawaWeb DeveloperCommented:
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
 
Gurpreet Singh RandhawaWeb DeveloperCommented:
Like this

 var dataset = [<cfoutput>#quotedValueList(myquery.ciitiesName)#</cfoutput>];
0
 
Bang-O-MaticAuthor Commented:
Works Perfectly! Thank you!
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now