multiple datasets on one input (autosuggest) field

rixsta's Avatar


15 Nov, 2012 09:48 AM

Hi there,

I am keen on using the Auto suggest plugin for my web site and was wondering if it supports the following scenario, and if so how?

I would like to provide a tool where a user can use an input field to type in a contact name or a group and the autosuggest showing the results based on those two different data sets (i.e. 2 sql database tables, contact & group). I would also like to format the contact name by showing the group name in brackets in the autosuggest search results. To illustrate with an example:

User types in 'Ja' and they can see something like the following:

Jack Jones (group 1)
Jane Smith (group 2)
Jackie Bloggs (group 1)

however if they also wish to select a group they can type 'Gr' and see something like:
Group 1
Group 2
Group 3
Group 4
Group 5 etc

Is this possible?

Hope you can help.

Kind regards,

  1. 1 Posted by Jon on 15 Nov, 2012 10:06 AM

    Jon's Avatar


    yes, the autosuggest plugin can work the way you want. Furthermore, it has nothing to do with the plugin itself, but with the data you use with it.

    Just get one only dataset with info about contacts and groups and use the plugin as normal (one input, one dataset). If you don't want or can't join the datasets then you'll need two different inputs or you will have to modify the plugin.

  2. 2 Posted by rixsta on 15 Nov, 2012 10:23 AM

    rixsta's Avatar


    thanks for your quick response, that's helpful. Also, I have checked the documentation and wasn't sure if duplicate entries could be prevented in the input box?

  3. 3 Posted by Jon on 15 Nov, 2012 10:50 AM

    Jon's Avatar

    If your dataset doesn't have duplicated entries, you won't be able to select the same item twice.

  4. 4 Posted by rixsta on 15 Nov, 2012 11:03 AM

    rixsta's Avatar

    that's great, thanks very much for confirming.

  5. rixsta closed this discussion on 15 Nov, 2012 11:03 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac