I think you are correct, calling setOutputMarkupId(true) is not necessary 
when calling setOutputMarkupPlaceholderTag(true).  If I remember correctly 
from looking at the code for  setOutputMarkupPlaceholderTag(), this will 
call setOutputMarkupId(true) for you.




From:   Duro <develma...@yahoo.com>
To:     users@wicket.apache.org
Date:   12/21/2010 08:24 AM
Subject:        Re: Visibility setting with Ajax



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






Notice: This communication, including any attachments, is intended solely 
for the use of the individual or entity to which it is addressed. This 
communication may contain information that is protected from disclosure 
under State and/or Federal law. Please notify the sender immediately if 
you have received this communication in error and delete this email from 
your system. If you are not the intended recipient, you are requested not 
to disclose, copy, distribute or take any action in reliance on the 
contents of this information.

Reply via email to