sanre6
sanre6

Reputation: 807

Closing a popup on form submit in wicket?

i have created a wicket popup window which opens on clicking a link like below

new BookmarkablePageLink("popupLink", Popup.class)

This Popup class has a form inside it which needs to be submitted and also the popup closed . Using PopupCloseLink i can close the popup but the form does not get submitted. If i use a AjaxSubmitButton how do i close this popup in onSubmit() ? Can this be done without using ModalWindow class ?

Thanks

Upvotes: 1

Views: 1713

Answers (1)

Thorsten Wendelmuth
Thorsten Wendelmuth

Reputation: 780

You could just append the javascript that PopupCloseLink adds during the onSubmit of your AjaxSubmitButton (see: PopupCloseLink$ClosePopupPage.html)

    AjaxSubmitLink close = new AjaxSubmitLink("close") {
        @Override
        protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
            super.onSubmit(target, form);
            target.appendJavaScript("javascript:self.close()");
        }
    };

Upvotes: 2

Related Questions