Autocomplete question

sfmerv - December 2, 2008 - 19:44

I have searched everywhere for this but can not find a solution for Drupal 6.

I want to have autocomplete in a textfield, but if the term that is being typed is not found then I want a new term inserted into the database. Right now I have a field that is a node reference and uses the autocomplete feature to bring up a list of possible terms but if your term is not there then you get an error instead of it just loading your new term.

So basically I what a text field with the autocomplete function of a node reference.

Do you want nodes or

nevets - December 2, 2008 - 20:39

Do you want nodes or terms?. If terms why not use a taxonomy vocabulary with free tagging enabled?

Sorry for mixing terms

sfmerv - December 2, 2008 - 21:13

I am already using tagging for the entries.

This might help. I am trying to build a recipe form. So under the name of the recipe there will be a list of ingredients and their amounts. What I want is that ingredient textarea to have an autocomplete feature so that if they start typing "Sugar" it will fill it in but if they are typing a new ingredient that is not there yet then I want it to enter that ingredient.

I am also still working on how to link he 2 fields (ingredient + amount) in the form andif you have any ideas for that let me know . I am using cck etc.

I am a newbie at this coming from the Joomla and cakephp world.

Any help would be great.

I answered how to tie 2

WorldFallz - December 2, 2008 - 22:03

I answered how to tie 2 fields together in your other topic. If you don't like those options the only other way would be to code it yourself.

If you want autocomplete on a text field you could do it by making "ingredients" a vocabulary with the different items being terms-- i can actually see a valid use case for this arrangement. It would also help when searching for recipes by ingredients. However, you'll then probably have to use the http://drupal.org/project/flexifield module for the compound field. You may also need the http://drupal.org/project/content_taxonomy module.

There's also the http://drupal.org/project/textfield_autocomplete module, but since work on a d6 port hasn't even started yet, it might be abandoned. The changes to cck for d6 probably make it nontrivial to port, though I haven't really looked at it so I don't know. If you have some coding skills (you mention cakephp) it may be worthwhile to look at porting it.

===
"Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime." - Lao Tzu
"God helps those who help themselves." - Ben Franklin
"Search is your best friend." - Worldfallz

Figured out the first one

sfmerv - December 2, 2008 - 23:16

Yeah I was following your links all today. So far using the Multigroup in cck is working well. I was looking at the taxonomy thing today also. I'll try what you said.

I am trying not to get to into the coding side right now since this project is really to learn Drupal and everyting it can do without much tweaking. Still just getting all the new terms and ideas straight before I break it with my own code.

Thanks for the tips.

 
 

Drupal is a registered trademark of Dries Buytaert.