Take a look at
http://www.nabble.com/1.3%2C-resource-locator-and-properties-to16707905.html#a16708440
control+f to help wanted for autocomplete
On Fri, Apr 25, 2008 at 12:29 PM, Ricky <[EMAIL PROTECTED]> wrote:
> Hi,
> I am trying to get a model object when an autocomplete selection is made;
> but model object comes back as a string rather than the model that was
> selected. Is there a way to get the selected Model (Actor) in the example
> below ?
>
> final AutoCompleteTextField actorAutoComplete = new
> AutoCompleteTextField("input-auto-complete-actor-search", new Model((Actor)
> getModelObject()), new AbstractAutoCompleteRenderer() {
> protected final String getTextValue(final Object object) {
> return object.toString();
> }
> protected final void renderChoice(final Object object, final
> Response response, final String criteria) {
> response.write(object.toString());
> }
> }) {
> protected final Iterator<Actor> getChoices(final String
> searchTextInput) {
> return getCollection().iterator();
> }
> };
> actorAutoComplete.add(new AjaxFormSubmitBehavior("onchange") {
> protected final void onSubmit(final AjaxRequestTarget
> target) {
> // MODEL OBJECT RETURNS STRING RATHER THAN AN ACTOR!!
> this.getComponent().getModelObject();
> }
> });
> }
> add(actorAutoComplete);
>
> Rick
>
--
Ryan Gravener
http://wmwm.us/wmwm-date