Hi,

I took a look at the solution below, unfortunately the above solution
doesn't work because if the model in getTextValue( ) method is set (for the
containing panel or any component for that matter) the *last* choice is
selected and set as a model instead of the right one. It works only when
there is only one selection in the drop down list. Any ideas would be
appreciable.

Rick

On Fri, Apr 25, 2008 at 12:40 PM, Ryan Gravener <[EMAIL PROTECTED]>
wrote:

> 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
>



-- 

Regards
Vyas, Anirudh
|| ॐ ||

Reply via email to