Hi,
It seems that updateModel() is called for invisible child components.
This causes an exception in the attached use case.
An IMHO crude workaround is to make all children explicitly invisible
instead of just setting the invisible state on the parent. However, the
FormComponent.IVistor in Form#updateModels shouldn't visit children of
invisible components at all.
Regards,
Johannes
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import wicket.markup.html.WebPage;
import wicket.markup.html.form.DropDownChoice;
import wicket.markup.html.form.Form;
import wicket.markup.html.list.ListItem;
import wicket.markup.html.list.ListView;
import wicket.model.PropertyModel;
public class Bug extends WebPage {
class InputForm extends Form {
private short value;
public InputForm(String id) {
super(id);
final List values = new ArrayList();
values.add(1);
values.add(2);
add(new ListView("list", values) {
protected void populateItem(ListItem item) {
item.add(new DropDownChoice("choice", new PropertyModel(InputForm.this, "value"), values));
item.setVisible(item.getIndex() == 0);
//crude workaround...
//item.get("choice").setVisible(item.isVisible());
}
});
}
public short getValue() {
return value;
}
public void setValue(short value) {
this.value = value;
}
}
public Bug() {
add(new InputForm("form"));
}
}