Thank you for your help!
It works great!
Benjamin
2007/8/24, Igor Vaynberg <[EMAIL PROTECTED]>:
>
> the problem is you replace it but do not update the reference so next time
> the onclick runs it calls replacewith on an old reference. it is a common
> mistake.
>
> EinsatzPanel newPanel = new EinsatzPanel("einsatzPanel", ein);
> newPanel.setOutputMarkupId(true);
> einsatzPanel.replaceWith(newPanel);
> einsatzPanel=newPanel; <==== what you are missing
>
> -igor
>
>
> On 8/24/07, Florian Sperber <[EMAIL PROTECTED]> wrote:
> >
> > Hi Benjamin,
> >
> > where is the Panel einsatzPanel defined?
> >
> > Maybe it helps defining it as a Class property?
> >
> >
> > Kind regards
> > Florian Sperber
> >
> > Benjamin Ernst wrote:
> > > 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
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>