[development] textfield from autocomplete to show value not key

Dave Reid dave at davereid.net
Sat Dec 19 21:38:57 UTC 2009


This is how the auto-completion works. If you want to keep the $name in the
textfield for the user, you should convert it to $id during form validation,
much like if a user enters an aliased path, we would want to convert it
using drupal_get_normal_path().

On display, you can re-covert it back to $name, much like we would use
drupal_get_path_alias().

Dave Reid
dave at davereid.net


On Sat, Dec 19, 2009 at 2:44 PM, Joop Sint Jago <j.sintjago at xs4all.nl>wrote:

>  I have an autocomplete field picking-up text suggestion from an array($id
> => $name).
>
> When I start typing in the text-field the list of suggestions is properly
> showing the values (names) of the array.
>
> When I select a name however the key ($id) is shown in the textfield.
>
>
>
> The only way to show the name in the textfield is to populate the array as
> ($name => $name).
>
> But then $name is returned on submission while I need the key.
>
> Am I missing something? Thanx
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20091219/3135d80e/attachment.html 


More information about the development mailing list