Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6856309
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:52:08+00:00 2026-05-27T01:52:08+00:00

I have a modal window with form inside it. There are two way user

  • 0

I have a modal window with form inside it. There are two way user can close the window: either by filling up correctly form and submit change, or clicking an “x” in top right corner.

Now I’m trying to do following thing:

When user sucesfully fills up the form and submit change, on parent page I’m trying to display (with jQuery) some information about success.

When user clicks an “x” I want the modal window to be closed without any additional info. However setWindowClosedCallback is not working as I expected. Take a look at my code, first I’m getting reference to modalWindow (I omitted some not interesting parts of the code like adding form inputs etc.):

public EditEmailForm( String id, final ModalWindow modalWindow,final User u )
{
    super( id );
    modalWindow.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() 
    {
    private static final long serialVersionUID = 1L;

    @Override
    public void onClose(AjaxRequestTarget target) 
    {
            //here some code doing jQuery magic for parent page
    }
});
    AjaxSubmitLink closeBtn = new AjaxCloseCancelBtn( "close-x", this );

    add( new AjaxSubmitLink( "save", this )
    {
        private static final long serialVersionUID = 1L;

        @Override
        protected void onSubmit( AjaxRequestTarget target, Form<?> form )
        {
        //here's user info change
        }

        @Override
        protected void onError( AjaxRequestTarget target, Form<?> form )
        {
            target.add( feedbackPanel );
        }
    } );
    add( closeBtn );
}


protected class AjaxCloseCancelBtn extends AjaxSubmitLink
{
    private static final long serialVersionUID = 1L;

    public AjaxCloseCancelBtn( String id, Form<?> form )
    {
        super( id, form );
        setDefaultFormProcessing( false );
    }

    @Override
    protected void onSubmit( AjaxRequestTarget target, Form<?> form )
    {
        modalWindow.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() 
        {
            private static final long serialVersionUID = 1L;

            @Override
            public void onClose( AjaxRequestTarget arg0 )
            {               
            }

        });
        // revert fields values
        form.clearInput();
        // close popup
        modalWindow.close( target );
    }

    @Override
    protected void onError( AjaxRequestTarget target, Form<?> form )
    {
    }

}

This code works 50% good, as it displays what I want on parent page, but it also does it when I hit an “x” even tho I’m trying to set new window close callback which is empty. Any solution how can I overcome this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T01:52:09+00:00Added an answer on May 27, 2026 at 1:52 am

    You need to call org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow.close(AjaxRequestTarget)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a Modal Window with a contact form within it. We have two
on my web site I want to have login/registration form in modal window done
I'd like to have a modal window that gets displayed when the user submits
I have this form that pops up in a modal window like so: <?php
I have a modal window with a login/sign-up form. I would like to prevent
I have a form inside a jquery ui modal dialog, when I click the
I have a form which I load within a modal window in that from
I have a modal window which opens up a login form, then i click
Does anyone have some nice examples of the ajax (modal window) login form popups?
I have a modal window that presents a form to users. The form includes

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.