add(new CheckBox("openLocationPanelLink") {
  oncomponenttag(tag) {
tag.put("onclick", "var panel=document.getElementById('" +
addLocationPanel.getMarkupId() +
 "');panel.style.display=this.checked?'block':'none';")));
}

that way your code will execute during render time at which markupid
is available.

-igor


On Feb 12, 2008 6:10 AM, Java Programmer <[EMAIL PROTECTED]> wrote:
> Hello,
> I have Panel on which in constructor I put nested Panel:
> public class RegisterUserPanel extends Panel {
>
> public RegisterUserPanel(String id) {
> ...
> final Panel addLocationPanel = new AddLocationPanel("addLocationPanel");
> addLocationPanel.add(new SimpleAttributeModifier("style", "display:none;"));
> add(addLocationPanel);
> add(new CheckBox("openLocationPanelLink").add(new
> SimpleAttributeModifier("onclick", "var
> panel=document.getElementById('" + addLocationPanel.getMarkupId() +
> "');panel.style.display=this.checked?'block':'none';")));
> ..
> }
>
> It's as you see another panel, and the exception is thrown:
> WicketMessage: This component is not (yet) coupled to a page. It has
> to be able to find the page it is supposed to operate in before you
> can call this method (Component#getMarkupId)
>
> It means for me that addLocationPanel.getMarkupId() is not setup yet
> (it could be quite obvious, because it's constructor and I haven't
> send any info about page to it, and probably it's send after creating
> instance). But what can i do in such situation? What is best pattern?
>
> Best regards,
> Adr
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to