You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Muro Copenhagen <co...@gmail.com> on 2010/01/18 11:12:18 UTC

Close window javascript

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

Re: Close window javascript

Posted by Muro Copenhagen <co...@gmail.com>.
Hi,

Thanks Sefan...that helped me on the way...

It's working now...

Best Regards
Muro

On Mon, Jan 18, 2010 at 1:03 PM, Stefan Droog <sd...@educator.eu> wrote:

> See
>
> ModalWindow.close(final AjaxRequestTarget target)
>
> S
>
> -----Original Message-----
> From: Muro Copenhagen [mailto:copenhag98@gmail.com]
> Sent: Monday, January 18, 2010 11:12 AM
> To: users@wicket.apache.org
> Subject: Close window javascript
>
> 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
>
> The information contained in this communication is confidential, intended
> solely for the use of the individual or entity to whom it is addressed and
> may be legally privileged and protected by professional secrecy. Access to
> this message by anyone else is unauthorized. If you are not the intended
> recipient, any disclosure, copying, or distribution of the message, or any
> action or omission taken by you in reliance on it is prohibited and may be
> unlawful. Please immediately contact the sender if you have received this
> message in error. This email does not constitute any commitment from Cordys
> Holding BV or any of its subsidiaries except when expressly agreed in a
> written agreement between the intended recipient and Cordys Holding BV or
> its subsidiaries. Cordys is neither liable for the proper and complete
> transmission of the information contained in this communication nor for any
> delay in its receipt. Cordys does not guarantee that the integrity of this
> communication has been maintained nor that the communication is free of
> viruses, interceptions or interference. If you are not the intended
> recipient of this communication please return the communication to the
> sender and delete and destroy all copies.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

RE: Close window javascript

Posted by Stefan Droog <sd...@educator.eu>.
See

ModalWindow.close(final AjaxRequestTarget target)

S

-----Original Message-----
From: Muro Copenhagen [mailto:copenhag98@gmail.com]
Sent: Monday, January 18, 2010 11:12 AM
To: users@wicket.apache.org
Subject: Close window javascript

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

The information contained in this communication is confidential, intended solely for the use of the individual or entity to whom it is addressed and may be legally privileged and protected by professional secrecy. Access to this message by anyone else is unauthorized. If you are not the intended recipient, any disclosure, copying, or distribution of the message, or any action or omission taken by you in reliance on it is prohibited and may be unlawful. Please immediately contact the sender if you have received this message in error. This email does not constitute any commitment from Cordys Holding BV or any of its subsidiaries except when expressly agreed in a written agreement between the intended recipient and Cordys Holding BV or its subsidiaries. Cordys is neither liable for the proper and complete transmission of the information contained in this communication nor for any delay in its receipt. Cordys does not guarantee that the integrity of this communication has been maintained nor that the communication is free of viruses, interceptions or interference. If you are not the intended recipient of this communication please return the communication to the sender and delete and destroy all copies.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org