Adding autocomplete to a CCK text field
jahwe2000 - November 23, 2008 - 19:28
Hello,
I would like to autocomplete some textfields in my cck form. I know the form_alter hook, but I don't quite know how to modify the form.
I have tried this:
$form['field_autor_text'][0]['#autocomplete_path'] = 'autocomplete/author_js';
But that just makes my text field disappear. Is there a kind of documentation? or does anyone here have a hint for me? that would be really great
regards,
Philip

info
Not sure if it's useful to you, but there's a page in the handbook on this topic: http://drupal.org/node/42552
Also, I doubt this will make your text field disappear but you have a typo: field_autor_text should presumably be field_author_text?
Finally, have you defined a path in your module at autocomplete/author_js? (Note, this path isn't anything to do with JavaScript: check out yoursite.com/user/autocomplete/x where x is the first letter of one of your usernames, for an example of a core autocomplete function and what it returns)
Jeff
________
Drupal Development,
http://marmaladesoul.com
thank you
hello,
thank you for the reply :)
the path is defined and works, if I call it directly (I have chosen the js ending due to the JSON format). The missing h in author is just the german spelling and used consistently.
I have used the tutorial to create my code... What I think happens is, that the path in the form structure has changed and my text field disappears, when the old path is used (for some reason...)
but after all, I am clueless
regards,
Philip
found the solution
I have now found the solution. my module tried to alter the form before CCK has created it. I now used the module weight module from the Utility project, and now it works fine :)