[development] textfield from autocomplete to show value not key
Joop Sint Jago
j.sintjago at xs4all.nl
Sat Dec 19 21:49:15 UTC 2009
Thanks Dave, I will do the conversion on validate.
Van: development-bounces at drupal.org [mailto:development-bounces at drupal.org]
Namens Dave Reid
Verzonden: zaterdag 19 december 2009 22:39
Aan: development at drupal.org
CC: j.sintjago at 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 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/138c4688/attachment.html
More information about the development
mailing list