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