Searching in a list of values (menulist, textbox)

Michael Hofer <[email protected]>
Newsgroups gmane.comp.mozilla.devel.xpfe
Message-ID <[email protected]>
Hello,

I want the user to be able to search and select a value from a 
predefined list. I'm using an editable menulist with a menupopup for 
this at the moment:

<menulist id="user" editable="false" sizetopopup="none" flex="1">
   <menupopup>
     <menuitem label="John Doe" value="1"/>
     <menuitem label="John Smith" value="2"/>
     <menuitem label="Max Mustermann" value="3"/>
   </menupopup>
</menulist>

The label is used for display while the value is returned to the server 
as the selected id. This works fine so far. The only problem is with the 
search.

Searching (by typing) only works by blindly typing the initial letters 
of the name. Also on longer strings you have to be really fast, or 
you'll have to start over again (typing timeout).

Making the menulist editable doesn't help either. While the user can 
type into the editable menulist in that case, the string is not applied 
as a search string (for filtering the list). Also I'd like to have 
inter-string-search (typing 'Smith') and ideally visual feedback (like 
highlighting search strings in the result list).

An option could be to write a custom autocomplete textbox (like 
described on 
https://developer.mozilla.org/en/How_to_implement_custom_autocomplete_search_component). 
But is it possible do get the ids of the entries into that? How do I get 
the id of the 'selected' element?

Isn't there some way to do a custom menulist/menupopup combination for 
this (couldn't find documentation on this)?

Thank you very much for your help!

regards,
Michael
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.