I forgot to mention that the first time I click yes, I get:

confirmation dialog called
yes button clicked

in console, and the conf dialog closes itself. when I open it for second time, 
I get
confirmation dialog called
yes button clicked
removal supposed to be called

and the item really gets removed, but why triggering it twice?

Thanks in advance!

From: Martin Asenov
Sent: Friday, February 12, 2010 10:20 AM
To: 'users@wicket.apache.org'
Subject: modal in a modal problem

Hello, everyone!

I experience a problem when triggering a modal window from another modal 
window. When a removal icon is clicked in the first modal, there's a 
confirmation dialog, that pops up. Although I've set everything up, the 
windowClosedCallback gets activated only when I confirm removal twice. I have 
no idea why it happens this way. The confirmation dialog works fine for all 
RepeaterHoldingPage-s I have, excluding the one I have placed in another modal. 
Here's the code of the conf dialog:

       public ConfirmationDialog(String question, final ModalWindow parent, 
final RepeaterHoldingPage page, final Object entry) {

             System.out.println("confirmation dialog called");

             questionLabel = new Label("question", question);
             yesButton = new AjaxButton("yes_button", new 
Model<String>(getString("yes"))) {

                    private static final long serialVersionUID = 1l;

                    @Override
                    protected void onSubmit(AjaxRequestTarget target, Form<?> 
form) {
                           System.out.println("yes button clicked");
                           parent.setWindowClosedCallback(new 
ModalWindow.WindowClosedCallback() {

                                  private static final long serialVersionUID = 
1L;

                                  @Override
                                  public void onClose(AjaxRequestTarget target) 
{
                                        page.removeItem(entry, target);
                                        System.out.println("removal supposed to 
be called");
                                  }
                           });

                           parent.close(target);
                    }
             };

What happens is that I trigger the conf dialog, press the 'yes' button and in 
the console the following gets printed:
confirmation dialog called;

Reply via email to