You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Michael Backmann <ja...@googlemail.com> on 2013/03/08 09:01:00 UTC

Change visibility of a component before onSubmit

Hello,
I would like to react on the onSubmit-method of an AjaxButton or normal 
Button. The problem is, I would like to make a panel (a customized 
progressbar) visible and after this there should be internal work and 
when it is finished, there should be a change to another page. If I try 
to put it all in the onSubmit-method then the calculation is done and 
the page is changed at the end of the request, but the panel is not 
changed to be visible before, because Wicket does it all in one request? 
If I change the visibility via an AjaxButton and do the calculation and 
the page change in an extra thread, then the panel is visible, the 
calculation is done, but the page change with setResponsePage does not 
work, because the request is already finished? How could I get the 
requested behaviour? Is there a possibility to add an 
AjaxOnChange-Listener to the panel, which reacts if the panel switches 
to visible or is there another good way?

Thank you in advance,
Micha


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


Re: Change visibility of a component before onSubmit

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

You will need to use WebSocket/Push/Streaming to be able to write several
times to the browser in one request.
Better think for another solution. Your current requirement seems to be
more complex to implement than you really want.
For example make an Ajax call to start the processing and show the panel
and then use an ajax timer behavior to check when the processing has
finished to make the redirect to the new page.


On Fri, Mar 8, 2013 at 1:53 PM, Andrea Del Bene <an...@gmail.com>wrote:

> Which version of Wicket are you using? Maybe you can do what you want with
> an AJAX listener.
>
>  Hello,
>> I would like to react on the onSubmit-method of an AjaxButton or normal
>> Button. The problem is, I would like to make a panel (a customized
>> progressbar) visible and after this there should be internal work and when
>> it is finished, there should be a change to another page. If I try to put
>> it all in the onSubmit-method then the calculation is done and the page is
>> changed at the end of the request, but the panel is not changed to be
>> visible before, because Wicket does it all in one request? If I change the
>> visibility via an AjaxButton and do the calculation and the page change in
>> an extra thread, then the panel is visible, the calculation is done, but
>> the page change with setResponsePage does not work, because the request is
>> already finished? How could I get the requested behaviour? Is there a
>> possibility to add an AjaxOnChange-Listener to the panel, which reacts if
>> the panel switches to visible or is there another good way?
>>
>> Thank you in advance,
>> Micha
>>
>>
>> ------------------------------**------------------------------**---------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@wicket.apache.org>
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@wicket.apache.org>
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com <http://jweekend.com/>

Re: Change visibility of a component before onSubmit

Posted by Michael Backmann <ja...@googlemail.com>.
I'm using version 6 of Wicket. Meanwhile I have found a solution. I 
split the interaction in two requests:

|AjaxButton  confirmButton=  new  AjaxButton("confirmButton",  layoutForm)  {

@Override
protected  void  onSubmit(AjaxRequestTarget  target,  Form<?>  form)  {
     super.onSubmit(target,  form);
     System.out.println("Second");
}
};

confirmButton.add(new  AjaxEventBehavior("onclick")  {

@Override
protected  void  onEvent(AjaxRequestTarget  target)  {
     System.out.println("First");
}
});|


Am 08.03.2013 12:53, schrieb Andrea Del Bene:
> Which version of Wicket are you using? Maybe you can do what you want 
> with an AJAX listener.
>> Hello,
>> I would like to react on the onSubmit-method of an AjaxButton or 
>> normal Button. The problem is, I would like to make a panel (a 
>> customized progressbar) visible and after this there should be 
>> internal work and when it is finished, there should be a change to 
>> another page. If I try to put it all in the onSubmit-method then the 
>> calculation is done and the page is changed at the end of the 
>> request, but the panel is not changed to be visible before, because 
>> Wicket does it all in one request? If I change the visibility via an 
>> AjaxButton and do the calculation and the page change in an extra 
>> thread, then the panel is visible, the calculation is done, but the 
>> page change with setResponsePage does not work, because the request 
>> is already finished? How could I get the requested behaviour? Is 
>> there a possibility to add an AjaxOnChange-Listener to the panel, 
>> which reacts if the panel switches to visible or is there another 
>> good way?
>>
>> Thank you in advance,
>> Micha
>>
>>
>> ---------------------------------------------------------------------
>> 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: Change visibility of a component before onSubmit

Posted by Andrea Del Bene <an...@gmail.com>.
Which version of Wicket are you using? Maybe you can do what you want 
with an AJAX listener.
> Hello,
> I would like to react on the onSubmit-method of an AjaxButton or 
> normal Button. The problem is, I would like to make a panel (a 
> customized progressbar) visible and after this there should be 
> internal work and when it is finished, there should be a change to 
> another page. If I try to put it all in the onSubmit-method then the 
> calculation is done and the page is changed at the end of the request, 
> but the panel is not changed to be visible before, because Wicket does 
> it all in one request? If I change the visibility via an AjaxButton 
> and do the calculation and the page change in an extra thread, then 
> the panel is visible, the calculation is done, but the page change 
> with setResponsePage does not work, because the request is already 
> finished? How could I get the requested behaviour? Is there a 
> possibility to add an AjaxOnChange-Listener to the panel, which reacts 
> if the panel switches to visible or is there another good way?
>
> Thank you in advance,
> Micha
>
>
> ---------------------------------------------------------------------
> 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