Alternately, you can put an EmptyPanel in as a placeholder until you have Panel2.
---Java Psuedo-Code--- Panel panel1 = new RandomPanel("panel1"); panel1.add(new EmptyPanel("panel2")); add(panel1); add(new AjaxButton("button", form){ onSubmit(AjaxRequestTarget target, Form form){ Panel panel2 = new RandomPanel("panel2"); panel1.replace(panel2); } }; Scott On Wed, Dec 30, 2009 at 9:17 AM, Igor Vaynberg <igor.vaynb...@gmail.com> wrote: > this should help > > http://wicketinaction.com/2008/10/repainting-only-newly-created-repeater-items-via-ajax/ > > the trick is to add the markup that the component is anchored to using > javascript. > > -igor > > On Wed, Dec 30, 2009 at 9:13 AM, wic...@geofflancaster.com > <wic...@geofflancaster.com> wrote: >> Is there a way to create an item only after a form has been submitted? >> >> For example, how can I do the following: >> >> ---Java Psuedo-Code--- >> Panel panel1 = new RandomPanel("panel1"); >> >> add(panel1); >> >> add(new AjaxButton("button", form){ >> >> onSubmit(AjaxRequestTarget target, Form form){ >> Panel panel2 = new RandomPanel("panel2"); >> } >> }; >> >> ---End java Psuedo-Code--- >> >> ---Psuedo-HTML--- >> ... >> <span wicket:id="panel1"><span wicket:id="panel2"></span></span> >> ... >> ---End Psuedo-HTML--- >> >> When I try it now I get an error saying panel2 is in my markup but not >> added to the page. Any help is greatly appreciated. >> >> Thanks! >> >> >> >> -------------------------------------------------------------------- >> mail2web.com – Enhanced email for the mobile individual based on Microsoft® >> Exchange - http://link.mail2web.com/Personal/EnhancedEmail >> >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org >> For additional commands, e-mail: users-h...@wicket.apache.org >> >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org