Hi guys,

We have a such widget in wicket-contrib-dojo. If I well understood it is a suggestionList giving to the server something different that what is displayed. On the html side it is seems to be an select item (automatically associate id with a text label). I think you just need to intrument it with some javascript to make somethink like :
http://www.demay-fr.net:8080/WCD13/app/?wicket:bookmarkablePage=%3Awicket.contrib.dojo.examples.SuggestionListSample

The first one is a widget giving hand to the server to choose what to display. and the second one works as a dropDown but with autocomplete



Jonathan Locke a écrit :
Don't you think it should work the same as other list selection components? You give the component a list of objects to choose between using the text
completion field and when the text is submitted, it sets the model of the
component to the first object in the list that matches the text.  If it
can't find it, the model is set to null.  If the list of objects are in
sorted order by their text, a binary search can be performed for the model
object.

If the text isn't unique, how is the user going to choose between two "Frank
Johnsons"?  I think the text has to be unique to complete like this.


Martijn Dashorst wrote:
I want to use the ACTF in our projects, but it is not very helpful for
selecting objects. Typically the text you display for
selecting a person is not very unique or identifying for the object
that is associated: "Johnson, Frank" is perfect for display,
but is hard to dissect when you have to re-assemble the person on the
server side: the ACTF uses a String as the model.

I was thinking of a panel with the autocomplete text field which shows
the display value, and a hidden field that will hold the ID
of the selected object. The hidden field can then be used to fetch the
object on the server and assign it to the model object of
ObjectAutoCompleteTextField.

<wicket:panel>
<input type="text" wicket:id="displayvalue" />
<input type="hidden" wicket:id="idvalue" />
</wicket:panel>

The OACTF would need to communicate both the selection markup, and the
associated ID values that need to be set on the hidden
field upon selection. Now I could add a special tag to the selection
markup, something like below:

<ul>
        <li choiceid="12341">Johnson, Frank</li>
        <li choiceid="41231">Miller, Frank</li>
</ul>

But I imagine other possibilities are available (or using the markup
id itself).  Can you share your thoughts?

Martijn


--
Learn Wicket at ApacheCon Europe: http://apachecon.com
Join the wicket community at irc.freenode.net: ##wicket
Wicket 1.2.5 will keep your server alive. Download Wicket now!
http://wicketframework.org




Reply via email to