panel.setOutputMarkupPlaceholderTag(true); should be done on panel creation: this is needed to tell wicket that even when the component is not visible it should render an empty div with a is set, so that it can be later used to plugin the panel contents via AJAX when you do setVisible(true). So, putting that on the onClick will not help you (I guess:-).
Ernesto On Tue, Dec 21, 2010 at 2:23 PM, Duro <develma...@yahoo.com> wrote: > thanks, setOutputMarkupId(true) is probably not necessary., but adding the > component to target and setOutputMarkupPlaceholderTag(true) is. > Now i tried to mak eit work even better and removed the panels from the > site. i want to add them just on time, when the user request it. so site > looks now like this: > > wicket:extend> > <div align="center" style="background-color:red;padding:20px"> > <h2>Epubs upload</h2> > <form wicket:id="form"> > <div style="background-color:#304050"> > <span wicket:id="panel"/> > <a href="#" wicket:id="addLink">Add next file</a> > <br/> > <input wicket:id="submitButton" type="submit" value="Datei(en) laden"/> > </div> > <div wicket:id="feedback" class="error" style="background-color:yellow"/> > </form> > </div> > </wicket:extend> > > > and i try to create the panel dynamically: > > public void onClick(AjaxRequestTarget target) { > panel.setOutputMarkupPlaceholderTag(true); > target.addComponent(panel); > panel.add(new UploadFilePanel("filePanel")); > > the markup of UploadFilePanel: > > <wicket:panel> > <table style="padding-bottom:5px"> > <tr> > <td width="180px">Typ</td> > <td><select wicket:id="type" /></td> > <td>Titel</td> > <td><input type="text" wicket:id="title" /></td> > </tr> > <tr> > <td>Jahr</td> > <td><input type="text" wicket:id="year" /></td> > <td>Ausgabe Nummer</td> > <td><input type="text" wicket:id="issueNumber" /></td> > </tr> > <tr> > <td>Datei</td> > <td><input wicket:id="fileUploadField" type="file" /></td> > <td colspan="2" valign="bottom">Ich bin Inhaber > des Mediens<input type="checkbox" wicket:id="ownerCheckbox"/></td> > </tr> > </table> > </wicket:panel> > > this all end in the error: > > WicketMessage: The component(s) below failed to render. A common problem is > that you have added a component in code but forgot to reference it in the > markup (thus the component will never be rendered). > > 1. [MarkupContainer [Component id = panelX]] > 2. [MarkupContainer [Component id = type]] > 3. [MarkupContainer [Component id = title]] > 4. [MarkupContainer [Component id = year]] > 5. [MarkupContainer [Component id = issueNumber]] > 6. [MarkupContainer [Component id = fileUploadField]] > 7. [MarkupContainer [Component id = ownerCheckbox]] > > i understand that i didnt declare the things in the markup, but thats what i > want (create them not at the start, but never or later, when the user clicks > on the link). So what is needed to create the UploadFilePanel dynamically? > thanks for help > > >> 1-Put >> >> uploadPanel2.setOutputMarkupId(true); >> uploadPanel2.setOutputMarkupPlaceholderTag(true); >> uploadPanel2.setVisible(false); >> >> when you create the panel. >> >> 2- on >> >> public void onClick(AjaxRequestTarget target) { >> uploadPanel2.setVisible(true); >> target.addComponent(uploadPanel2); >> } >> >> Ernesto >> >> On Tue, Dec 21, 2010 at 1:38 PM, Juraj Petko<juraj.pe...@gmail.com> >> wrote: >>> >>> Hi, i have 3 panels on my page: >>> wicket:extend> >>> <div align="center" style="background-color:red;padding:20px"> >>> <h2>Epubs upload</h2> >>> <form wicket:id="form"> >>> <div style="background-color:#304050"> >>> <span wicket:id="uploadPanel1"/> >>> <span wicket:id="uploadPanel2"/> >>> <span wicket:id="uploadPanel3"/> >>> <a href="#" wicket:id="addLink">Add next file</a> >>> <br/> >>> <input wicket:id="submitButton" type="submit" value="Datei(en) laden"/> >>> </div> >>> <div wicket:id="feedback" class="error" style="background-color:yellow"/> >>> </form> >>> </div> >>> </wicket:extend> >>> >>> and only after clicking addLink, the user should see the uploadPanel2. So >>> i >>> coded this: >>> >>> add(new AjaxFallbackLink("addLink") { >>> private static final long serialVersionUID = >>> -4427831923318024979L; >>> >>> �...@override >>> public void onClick(AjaxRequestTarget target) { >>> uploadPanel2.setVisible(true); >>> } >>> }); >>> >>> When i debug, the method onClick() is really entered and >>> uploadPanel2.setVisible(true) is executed, but the panel is still not >>> visible. What else i have to do? >>> thanks! >>> >>> >>> --------------------------------------------------------------------- >>> 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 >> > > __________________________________________________ > Do You Yahoo!? > Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz > gegen Massenmails. http://mail.yahoo.com > --------------------------------------------------------------------- > 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