Hello, Recently started a wicket project and was making excellent progress till ran into a problem with DropDownChoices. I am trying to get a DropDownChoice to add a panel to a form when an option is selected. The DropDownChoice contains a list of URI properties that each map to a different datatype. When a URI is selected in the drop down the correct component (DateField, textField, checkbox etc) needs to be added to the form to edit the property value. I am using fragments to actually render the right component for the datatype (as specified in the Bean editor example).
My DropDownChoice does the following: protected boolean wantOnSelectionChangedNotifications() { return true; } protected void onSelectionChanged(final URI newSelection) { remove(dropdownChoice) add(new BagValueFormPanel(getComponentFactoryForURI(newSelection)) } The BagValueFormPanel has a supporting model that adds edit components in a ListView along with a + symbol to add more components. Unfortunately my list view panel does not get all the list items rendered. When running the BagValueFormPanel unit test, I get the following debug tree: INFO BaseWicketTester - path form:panel wicketclient.components.form.BagValueFormPanel [[= null &&]] INFO BaseWicketTester - path form:panel:valuesList org.apache.wicket.markup.html.list.ListView [[= null &&]] INFO BaseWicketTester - path form:panel:valuesList:0 org.apache.wicket.markup.html.list.ListItem [= null &&] INFO BaseWicketTester - path form:panel:valuesList:0:valueFragment org.apache.wicket.markup.html.panel.Fragment [] INFO BaseWicketTester - path form:panel:valuesList:0:valueFragment:value wicketclient.panels.search.QueryElementPanel [= null &&] INFO BaseWicketTester - path form:panel:valuesList:0:valueFragment:value:condition org.apache.wicket.markup.html.form.DropDownChoice [=] INFO BaseWicketTester - path form:panel:valuesList:0:valueFragment:value:value org.apache.wicket.markup.html.panel.Fragment [] INFO BaseWicketTester - path form:panel:valuesList:0:valueFragment:value:value:value org.apache.wicket.markup.html.form.TextField [] INFO BaseWicketTester - path form:panel:valuesList:0:valueFragment:value:booleanOp org.apache.wicket.markup.html.form.DropDownChoice [&&] But when running the test for the dynamic DropDownChoice panel where the selection is made to one of the list choices, I get the following tree (form:panel:filterParameterPanel:valuesList is the matching component): INFO BaseWicketTester - path form org.apache.wicket.markup.html.form.Form [] INFO BaseWicketTester - path form:panel wicketclient.panels.search.PropertySelectComponent [] INFO BaseWicketTester - path form:panel:propertyName org.apache.wicket.markup.html.panel.Fragment [] INFO BaseWicketTester - path form:panel:propertyName:property org.apache.wicket.markup.html.basic.Label [Or The Other] INFO BaseWicketTester - path form:panel:filterParameterPanel wicketclient.components.form.BagValueFormPanel [[= null &&]] INFO BaseWicketTester - path form:panel:filterParameterPanel:valuesList org.apache.wicket.markup.html.list.ListView [[= null &&]] INFO BaseWicketTester - path form:panel:filterParameterPanel:addValue org.apache.wicket.markup.html.form.SubmitLink [] Is this kind of dynamic addition of components possible on an onSelectionChanged? If not I probably won't be able to add the panel in earlier and delay the selection of the right Fragment to render the edit control right? Cheers Sumit