I am looking for a module that can provide auto-suggestion or auto-completion for a regular, non-taxonomy field: so that when a user types in a field of a searchbox, e.g. - the field is "animal name", then if s/he types in "ca", it can provide a pulldown list of animal names, like "cat, catepillar ...", which are selected from an existing table of mysql database. this is something like Google suggestion.

I find there are modules of auto-comlete for and based on vocabulary/taxonomy; but I have not found one for a regular field. Can you help me with that?
thanks! hujia

Comments

johnhanley’s picture

There's a variety of ways to implement autocomplete. Are you using CCK and creating a custom module?

-------------------------------------------------------

"If you don't read the newspaper you are uninformed;
if you do read the newspaper you are misinformed."
-- Mark Twain

hujia’s picture

I am using cck and my search is basically my custom module. I am thinking of adding my own ajax auto suggest, but I'm also very interested to know if there are already some modules already laying there around to download and plugin ...
thanks! H

kellyexpo24’s picture

Do any of these work?

http://webtecker.com/2008/03/10/10-auto-complete-ajax-scripts/

I've seen these scripts around a lot. There should be a number of free copies to grab. Credit if it's for commercial purposes of course ;)

dewbie’s picture

Hi
I have a similar requirement. I want to achieve this for a 5 field form on my homepage. I am new to drupal. Can you please share the code snippett and advice me how to go about it.

johnhanley’s picture

You're best bet is to create a Views block containing a form built with CCK fields defined as autocomplete. The autocomplete fields need to be associated with a data source like users, taxonomy terms or even custom (the latter requiring additional effort.)

dewbie’s picture

Hi

My requirement is to provide user the ease of selecting an option- which appear as a part of a suggestion list , which pops up as the user types in the name of city or state or country.
Can you please tell me more about the View Block and CCk?
And what are the steps i need to follow to achieve the above?

Thanks

johnhanley’s picture

You could create a predefined or free-tag taxonomy vocabulary containing city, state and country terms and then associate it with the content type (presumably a profile.) Set the CCK field as autocomplete, which will give you the type ahead behavior you want.

There should be how-to's already available on how to accomplish this or something like it.

mortenson’s picture

Hpw could I do the same ypu mention (bacteria man) but for a profile field?

johnhanley’s picture

I assume you're asking about the core profile module (?) If so, create a "freeform list" profile field.

mortenson’s picture

Yes I am asking about core profile module

I need to build a field for the user to enter "University" in their profile. So that when he types the form will autocomplete (like Facebook).

If I create a freefor list where would I put the options I want to give(the database with all the universities)?

thanks for any help

johnhanley’s picture

I actually misspoke in my last post. It sounds like what you want is a "single-line textfield" w/ autocomplete enabled ("Form will auto-complete while user is typing.") However this still might not give you what you want because the autocomplete entries is limited to previously entered values by users (and assuming the "access user profiles" permission is enabled.)

If you want to use a pre-defined list of entries you'll probably need to create a custom module. However the core profile module doesn't provide the necessary hooks to make this easy. You might want to consider switching to Content Profile (Drupal 6) so you can utilized CCK fields and better autocomplete support.

mortenson’s picture

That is exactly what I need.

So you recomned swithching to Content Profile and then create a custom module?
So you can`t get rid of developing anyway?

johnhanley’s picture

Content Profile stores the profile data as nodes. This will allow you to associate a taxonomy category with predefine the terms. However the autocomplete requirement still remains. You might check out this module (with the funny name) and see if it'll get you the rest of the way there.

Stomper’s picture

I have a custom CCK content form with multiple fields - text, integer, link etc.

Where do I set the CCK fields to "autocomplete," is it within "manage fields" under "administer" -> "content types" -> "my content type"?

I have create several views from the content form, namely an exposed filter content search form, and I also used the "expose form as block." Is the "autocomplete" setting within the "Views" menu?

Thanks

thekayra’s picture

How about Finder module. It even allows you to create the views that you want to get the information from.