Updating the message contents for a MessageDialog wicket

374 views Asked by At
        //TrainingDialog associated with save button
        trainingDialog = new MessageDialog("trainingdialog", "Warning", "Message contents here",
                DialogButtons.OK, DialogIcon.WARN) {
            public void onClose(AjaxRequestTarget target, DialogButton button) {
                if (button != null && button.match(LBL_OK)) {
                    target.prependJavaScript("return saveClick()");
                    saveButton.add(new AttributeModifier("onclick", "return saveClick()"));
                    target.add(saveButton);
                    //note: predefined button text are:
                    //LBL_OK, LBL_CANCEL, LBL_YES, LBL_NO, LBL_CLOSE, LBL_SUBMIT
                }
            }
        }; 


        add(trainingDialog);

Now before I show the dialog using trainingdialog.open(target)

is there a way i can update the contents of the dialog?

1

There are 1 answers

0
martin-g On

Assuming that MessageDialog is from Wicket JQuery UI library then you can just do trainingDialog.setModelObject("New message").