I don't think it is, the getMmodelObject() returns the selected String. I've gotten around this by saving the last query string sent via AJAX. When the user makes a selection, I iterate over the options for that query string one more time, and take the POJO whose rendered string matches the user-selected text.

I'm probably missing something obvious, but I don't think getModelObject() is it...




--
Sam Barnum
360 Works
http://www.360works.com
415.865.0952



On Feb 5, 2008, at 2:12 PM, Igor Vaynberg wrote:

shouldnt the pojo be availble from getmodelobject()?

-igor


On Jan 29, 2008 11:55 AM, Michael Mehrle <[EMAIL PROTECTED]> wrote:
I could - if it was a simple matter of extracting the strings from the
POJOs. Problem is that, once an option is selected, I need the
underlying POJOs to become the model for the rest of the form. Yes,
there's probably a way to hack this, but I would prefer to do this in a
clean fashion.

I already got the custom renderer working, so I'm making progress. Task
#2 now is to grab the underlying POJO after selecting it and populate
the remainder of the form. This seems to be the tough part... Again, any
help would be appreciated.

Thanks!!

Michael


-----Original Message-----
From: Igor Vaynberg [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 29, 2008 11:47 AM
To: users@wicket.apache.org
Subject: Re: Passing list of POJOs to AutoCompleteTextField?

can you not create an iterator adapter that takes an iterator of pojos
and translates the pojo to some string?

-igor


On Jan 29, 2008 11:14 AM, Michael Mehrle <[EMAIL PROTECTED]> wrote:
I have a working test page containing an AutoCompleteTextField. Thus
far
the data feeding it has been an Iterator of strings which is being
passed to its overridden getChoices method. So far so good.

What I need to do now is to pass in an Iterator of POJOs instead and
have the AutoCompleteTextField render the 'name' field inside each of those beans. After some digging in the Wicket source I suspect that I
need to create a custom renderer that does this - am I on the right
track here or would you guys suggest a different approach?

Another challenge will be to populate other form fields in the page
after selecting an option from the AutoCompleteTextField. By selecting
an option in the dropdown I am basically selecting an entire POJO,
which
is supposed to be used as the model for the other remaining fields.
For
instance, the POJO will contain address, zip, phone, etc. fields and
by
selecting the appropriate name in the AutoCompleteTextField it
populates
all other fields with the remaining data in the underlying POJO. Hope
this makes sense - I think I have an idea of how to implement this,
but
would appreciate any tips/insights.

Thanks!!

Michael




-------------------------------------------------------------------- -
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Reply via email to