Hi,

I'm trying to close a popup window after the user has submitted a message.

I'm using a javascript to close the window but without any luck.

Can anyone see what goes wrong?

This is the AjaxSubmitLink that should submit the message and close the
window:

        AjaxSubmitLink submit = new AjaxSubmitLink("submitLink") {

            @Override
            public void onSubmit(AjaxRequestTarget target, Form form) {
                if (log.isDebugEnabled()) {
                    log.debug("Saveing comment" + comment);
                }
                target.addComponent(response.setVisible(true));
                target.addComponent(this.setVisible(false));
                caseCommentService.create(...);

                this.getPage().add(new
AbstractAjaxTimerBehavior(Duration.milliseconds(3000)) {

                    protected void onTimer(final AjaxRequestTarget target) {
                        stop();
                        target.prependJavascript("window.close();");
                    }
                });
            }
        };
        myForm.add(submit);

What i'm trying to achieve is to show a
message(response.setVisible(true))..) in three seconds before closing the
window.

But something it does not seem to work.

Best Regards
Muro

Reply via email to