You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Ch...@t-systems.com on 2017/02/23 15:20:38 UTC

nested forms with modal window

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




AW: AW: nested forms with modal window

Posted by Ch...@t-systems.com.
I close the window in the onSubmit method of the modal window form, you see this below. How can I notify the Button of the mother form that he can execute the other statements because the window is closed?

I don't want to update an component what should I put in the WindowClosedCallback?


Mit freundlichen Grüßen
Christoph Manig


-----Ursprüngliche Nachricht-----
Von: Sven Meier [mailto:sven@meiers.net] 
Gesendet: Freitag, 24. Februar 2017 10:58
An: users@wicket.apache.org
Betreff: Re: AW: nested forms with modal window

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.Manig@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:sven@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.Manig@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-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


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


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


Re: AW: nested forms with modal window

Posted by Sven Meier <sv...@meiers.net>.
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.Manig@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 Gren
> Christoph Manig
>
> -----Ursprngliche Nachricht-----
> Von: Sven Meier [mailto:sven@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.Manig@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 Gren
>> Christoph Manig
>>
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


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


AW: nested forms with modal window

Posted by Ch...@t-systems.com.
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:sven@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.Manig@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-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


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


Re: nested forms with modal window

Posted by Sven Meier <sv...@meiers.net>.
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.Manig@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 Gren
> Christoph Manig
>
>
>
>


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