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:[email protected]] 
Gesendet: Donnerstag, 23. Februar 2017 16:36
An: [email protected]
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, [email protected] 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: [email protected]
For additional commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to