Thanks Dave, I will do the conversion on validate.
Van:
development-bounces@drupal.org [mailto:development-bounces@drupal.org] Namens
Dave Reid
Verzonden: zaterdag 19 december 2009 22:39
Aan: development@drupal.org
CC: j.sintjago@xs4all.nl
Onderwerp: Re: [development] textfield from autocomplete to show value
not key
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@davereid.net
On Sat, Dec 19, 2009 at 2:44 PM, Joop Sint Jago <j.sintjago@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