[development] Autocomplete For A "Select" Widget

John Handelaar john at userfrenzy.com
Fri May 19 18:23:48 UTC 2006


Rob Thorne wrote:
> I'm looking at using autocomplete for contacts stored in CiviCRM.  
> Implementing basic autocomplete using the standard Drupal hook was 
> pretty simple: just search the CRM store for a contacts "display name" 
> via the autocomplete handler.
> 
> But there's a problem with how the standard handler works:  display 
> names are not unique.  What I probably *need* to do is this:  use the 
> autocomplete field to populate a "select" widget that uses the display 
> name as the label, and the unique numerical contact_id as the key.
> 
> Before I start looking into implementing this myself:  have any of you 
> implemented this kind of widget?  Or do you have advice how best to do 
> this?

It's not *exactly* similar but I posted a two-step
autocomplete example here:

http://drupal.org/node/50073

In your case I'd probably use 'onclick' on the selected
name and then build/write the SELECT using the clicked
name as a WHERE clause if the DB has >1 results


-- 
-------------------------------------------
John Handelaar

E  john at handelaar.org    T +353 21 427 9033
M  +353 85 748 3790    http://handelaar.org
-------------------------------------------



More information about the development mailing list