Is there an example of this somewhere?  I'm struggling to get this working where I have a HashMap<String, String>...the first String is the ID and the second String is the value.

I have this:
            IModel dropDownModel = new Model()
            {
                protected Object load()
                {
                    return StringValues.getUSAStates();
                }
            };

            add(new DropDownChoice("billingState", dropDownModel, new IChoiceRenderer()
            {
                public String getDisplayValue(Object object)
                {
                    return object.toString();
                }
               
                public String getIdValue(Object object, int index)
                {
                    return object.toString();
                }
            }));

I *just* wanted to see the page render...I know the values aren't right...but anything would have been acceptable.  I keep getting a very unhelpful NullPointerException that I'm not even sure has anything to do w/ the dropdowns...but I assume it does since the rest of the form is very straightforward TextField components.

I don't see where this is being done in wicket-examples....I'm using 1.1.1

Thanks!

On 4/1/06, Johan Compagner < [EMAIL PROTECTED]> wrote:
there is no map support for this.

What you could do is give the map to the ChoiceRenderer impl
and give the keys of the map as a list to the Choice.

johan



On 3/31/06, Vincent Jenks <[EMAIL PROTECTED]> wrote:
I'm trying to get a Map of data so I can have the key be the value of the dropdown options and the value of the Map item be the value of the option in the dropdown.  Problem is, it doesn't look like DropDownChoice will accept a Map...unless I'm doing it wrong?

Is a Map the best way to go?  I was maybe considering using a single List collection and splitting a single string to get the two values....but that's pretty fugly too.


Reply via email to