Hi, I am trying to replace a Panel, which is inside a Form, which is inside a Page, which is inside a ModalWindow. The first time it works fine, but when I want to replace it a second time, the Panel has no parent.
Here is the code: listItem.add(new AjaxButton("pflege", MitarbeiterForm.this) { @Override protected void onSubmit(AjaxRequestTarget target, Form form) { EinsatzPanel newPanel = new EinsatzPanel("einsatzPanel", ein); newPanel.setOutputMarkupId(true); einsatzPanel.replaceWith(newPanel); target.addComponent(newPanel); } }); An here is the Error: 2007-08-24 14:53:18,681 ERROR [http-8080-Processor24] org.apache.wicket.RequestCycle: This method can only be called on a component that has already been added to its parent. java.lang.IllegalStateException: This method can only be called on a component that has already been added to its parent. at org.apache.wicket.Component.replaceWith(Component.java:2224) at de.csg.fips.fe.anzeige.mitarbeiter.pflege.MA_PflegePage$MitarbeiterForm$1$1.onSubmit (MA_PflegePage.java:251) at org.apache.wicket.ajax.markup.html.form.AjaxButton$1.onSubmit( AjaxButton.java:82) I donĀ“t know why it only works one time. Thanks for any help in advance, Benjamin