On Thursday 03 July 2008 18:50:06 mettwoch wrote: > Hi, > > I've been reading through the posts related to the AutoComplete Field > and I'm even more confused. My simple (?) question is: > > Can the AutoComplete Field behave like a SingleSelect Field? > > 1) Feed it with (<id>, <name>) tuples from the associated search > controller > 2) Provide an <id> at render time and it shows the related <name> > 3) Get back the <id> value when the containing form is submitted > > I guess it doesn't. At least point 2) seems a constraint because it > looks up the <name> part in the search controller and not the id. > > Well, if it really doesn't, can someone point me to another widget to > use (a kind of dynamically feed SingleSelect widget).
I never used AutoComplete, but I fail to see where your usecase is sensible. First of all - if the mapping between ids and names isn't bijective, you would end up with any of several ids and need to select one arbitrary anyway. So a reverse lookup of value to key (using a custom validator for example) is possible & easy. And if you don't want to allow an arbitrary value to be entered (think tagging) - why allow any entering free text at all? Why not use the SingleSelectField, which the browser already implements with incremental search? If you *must* (or want) AutoComplete, then use validation to restrict the input to the allowed names. Diez --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TurboGears" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/turbogears?hl=en -~----------~----~----~----~------~----~------~--~---

