Hi,

it's your code which closes the ModalWindow, you can notify other parts of your project that the window will be closed.

Or use a WindowClosedCallback.

Have fun
Sven


On 24.02.2017 10:00, christoph.ma...@t-systems.com wrote:
Hello,

what can I do to realize it that the loop will be executed after the modal 
window was closed? I need the data which adds the modal window to the message 
objects.


Mit freundlichen Grüßen
Christoph Manig

-----Ursprüngliche Nachricht-----
Von: Sven Meier [mailto:s...@meiers.net]
Gesendet: Donnerstag, 23. Februar 2017 16:36
An: users@wicket.apache.org
Betreff: Re: nested forms with modal window

Hi,

public void onSubmit(AjaxRequestTarget target, Form<?> form) {
  remarkModalWindow.show(target);
  for(FaultModel fm : selectedModel.getObject()) {
    System.out.println("ActionButton Remark: " + fm.getFaultRemark());
  }
}
the submit of my modal window will be executed ... after he runs through the 
selectedModel.
Wicket's modal window isn't 'modal' in that it holds processing until it is 
closed again.
So of course your loop will execute immediately after telling the model window 
to be shown - it will not be shown until the current thread has finished 
request processing.

Regards
Sven


On 23.02.2017 16:20, christoph.ma...@t-systems.com wrote:
Hello,

I have a form which contains a modal window. The submit button of this form is 
an AjaxButton and should first open the modal window. This form contains a 
collection of message object which should be changed by the modal window.

The modal window also contains a form and a AjaxButton to submit the form. Here 
the user can write something into a textfield and submit this form of the modal 
window. So the message objects will be changed by the users input and then the 
modal window will be closed by modalWindow.close(target).

This is the submit of the mother form:
@Override
public void onSubmit(AjaxRequestTarget target, Form<?> form) {
          remarkModalWindow.show(target);
          for(FaultModel fm : selectedModel.getObject()) {
                  System.out.println("ActionButton Remark: " + 
fm.getFaultRemark());
          }
}

The selected model is a collection of messages which should be changed by the 
modal window. Therefore I will show the submit of the form of the modal window:
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
          RemarkForm remarkForm = (RemarkForm)form;
          for(FaultModel faultModel : 
remarkForm.getSelectedModel().getObject()) {
                  System.out.println("Sets the old remark " + faultModel.getFaultRemark() 
+ " to " + remarkForm.getModelObject().getFaultRemark());
                  
faultModel.setFaultRemark(remarkForm.getModelObject().getFaultRemark());
          }
          remarkForm.getRemarkModalWindow().close(target);
}

The change of the remark is successful and the window will be closed fine. But 
on my console I see the output:

ActionButton Remark: null
Sets the old remark null to testen

So it says the submit of my modal window will be executed to late. It will be 
triggered after he runs through the selectedModel. But first I want to change 
the selectedModel by the modal window and close it and then I want to write the 
output in the mother submit to the console. Why did he trigger the next steps 
after calling modalWindow.show? I thought the inner form have to be submitted 
before the next steps of the mother submit will be called.

What can I do here?


Mit freundlichen Grüßen
Christoph Manig





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


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



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

Reply via email to