Hello!  I need the value of the AutoCompleteTextField's default model to be
something other than the rendered value of the IAutoCompleteRenderer, and I
was wondering if someone could help.

I have a component that extends an AutoCompleteTextField for a list of
Concept objects. Each Concept object has fields for a name (not guaranteed
to be unique) and a (somewhat human-readable) id. For example:

"dog" (#$Dogs)
"dog" (#$HotDog)
"dog" (#$Dog-TheWord)

... and so on. And, that's exactly how I'd like the concepts rendered in the
dropdown: the name, followed by the id. Not a problem: I implemented an
IAutoCompleteRenderer for which #getTextValue takes the two values, stitches
them together, and returns them as a string.

The problem happens when someone selects one of those values: the
AutoCompleteTextField gets populated with the string value as rendered by my
IAutoCompleteRenderer. I'd rather that the AutoCompleteTextField's default
model contain the Concept object itself, or at the very least, just a string
representation of the Concept's id (so that I can look up the Concept
elsewhere.) Having the name and the id mashed together is problematic.

So, I need the value of the AutoCompleteTextField's default model to be
something other than the rendered value of the IAutoCompleteRenderer: either
the original object that was rendered, or a different rendering of it. In
essence, the behavior of the DropDownChoice component. Is there a reasonable
way to accomplish this? I've poked around a bit in AutoCompleteBehavior,
AbstractAutoCompleteBehavior, and AutoCompleteTextField, and I don't see a
clean solution, but perhaps I've overlooked something.

Also, thanks a TON for Wicket. I've been using it off and on for about a
year now, and I can't *imagine* doing web development without it. It's an
absolutely fantastic framework.

Thanks,

- Nathan

Reply via email to