You have to overwrite AutoCompleteTextfield#getConverter() and provide a 
converter for your object.

You can use #getChoices() to find the correct object for the new input.

Sven

Daniele Dellafiore <[email protected]> schrieb:

>Hi.
>
>I'm sure I'm talking about something that has already been discussed
>here and on stackoverflow a lot, but still I haven't found a solution.
>
>I do not understand how AutocompleteTextField works when dealing with
>list of objects that are not just strings. Other wicket components
>like DropDown has a clear pattern: the renderer is used only for
>rendering purpose, there's a model to store selection and a model to
>store choices options.
>
>Still, I can't figure out how to do the very same thing with
>AutocompleteTextField.
>
>The best I can get is:
>               TextField codeField = new 
> AutoCompleteTextField<JSONObject>("code",
>model, JSONObject.class, renderer,
>                     new AutoCompleteSettings());
>
>
>I'm using an AbstractAutoCompleteTextRenderer and a PropertyModel
>binded to a JSONObject variable.
>It all works but when I submit the form, it says me that the selected
>string is not a valid JSONObject, so he cannot attach it to the field.
>
>the ITerator returned by AutocompleteTextField.getChoices(String
>input) is an Iterator of JSONObject.
>I expect that when I submit, the setObject receives the selected
>JSONObject, not the String I do render using a specific Renderer.
>
>How can that be done?
>
>Thanks anyone for help.
>
>-- 
>Daniele Dellafiore
>http://danieledellafiore.net
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [email protected]
>For additional commands, e-mail: [email protected]
>

Reply via email to