Hi,

I have a strange problem with the PropertyModel and a form. The property
model is bound with one of my class, like that:


          shops = new DropDownChoice("shop", new PropertyModel(formTarget,
"shops"), new ShopDAO().findAll(), new ChoiceRenderer() {
            @Override
            public Object getDisplayValue(Object o) {
                if (o instanceof Shop) {
                    Shop s = (Shop) o;
                    return s.getName() + " (" + s.getUrl() + ")";
                }

                return null;
            }
        });


My "formTarget" has setShop and getShop methods. 

I have in this form an  "edit(MyClass)" method, for editing an existing
record. It looks like this:


public void edit(MyClass l) {
     [...]

    shops.modelChanging();
    formTarget.setShops(l.getShops());
    shops.modelChanged();

     [...]


And when I test it, sometimes it works fine (the drop down choice selects
the right item), and sometimes not (it selects the "null" value). I played a
little with it, and about half time there is no problem and half time the
"null" value is selected... (and I'm certain the property isn't null)

Is is a known issue? How can I fix it?

Thank you very much ;)
 

-- 
View this message in context: 
http://www.nabble.com/Strange-behavior-with-DropDownChoice-and-PropertyModel-tf4778358.html#a13669185
Sent from the Wicket - User mailing list archive at Nabble.com.

Reply via email to