The custom validator hint is the beginning of a possible solution with the AutoComplete Widget.
As I mentioned some posts ago, I'm writing a managing system (front- and back-office) for the shop I own and I can't use the SingleSelect Field because it would contain about 16000 entries (products). You mention "... incremental search ...". What is that? The user must also be able to enter a new text (the product code) not contained in the list of choices. The field accepts also entry from a barcode reader (I think that I should take some time at a later time to explain what I'm currently developing ... by the way, I feel that the final product might interest more people, but I'm not having the time to manage all the implication of publishing it. Any help at a later point will be absolutely appreciated) Marc On Jul 3, 7:24 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > 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 -~----------~----~----~----~------~----~------~--~---

