using
AdminPage.this.get("message").replaceWith(lbl);
instead of just
this.get("message").replaceWith(lbl);
might work, since message is added to the page, not to the delete button..
Phillip Rhodes wrote:
I am trying to update the label text on a page from a inner class (onSubmit) of
my page.
I used the page.get("componentid") method, but it returns null. While I could
just store the reference to the label as a variable in my page class, I would like to
understand how to obtain a reference to it using the wicket API.
When I use the following snippet, my "get" method always return null.
Thanks, appreciate the help.
public class AdminPage extends WebPage {
public AdminPage() {
add(new Label("message", "If you see this message wicket is properly
configured and running"));
DMIRequest dmiRequest = new DMIRequest();
Form myform = new Form("myform", new CompoundPropertyModel(dmiRequest));
add(myform);
myform.add(new DeleteButton());
}
}
private class DeleteButton extends Button
{
private static final long serialVersionUID = 1L;
private DeleteButton()
{
super("delete", new ResourceModel("delete"));
setDefaultFormProcessing(true);
}
@Override
public void onSubmit()
{
Label lbl = new Label("message", "Deleted");
this.get("message").replaceWith(lbl);
}
}
---------------------------------------------------------------------
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