You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Ulrich <Fo...@gombers.de> on 2015/04/21 08:09:51 UTC

How to close a ModalWindow without AjaxRequestTarget

I have already  asked this question
<http://apache-wicket.1842946.n4.nabble.com/Modal-panel-reloaded-when-selecting-from-DropDownChoice-td4670394.html>  
but maybe it was off topic there.

The Modal Window provides the method #close(AjaxRequestTarget). But I want
to provide a Button to validate entered data and display a message in case
of error otherwise close.
If I use AjaxSubmitButton() to handle the button the message is not part of
the target and not updated. I I use Link() the message becomes updated but I
have no means to close the window.
HTML:


Java:



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-close-a-ModalWindow-without-AjaxRequestTarget-tp4670429.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: How to close a ModalWindow without AjaxRequestTarget

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
AjaxButton should be fine... by overriding

protected void onSubmit(AjaxRequestTarget target, Form<?> form)
{
}

/**
 * Listener method invoked on form submit with errors
 *
 * @param target
 * @param form
 */
protected void onError(AjaxRequestTarget target, Form<?> form)
{
}

On Tue, Apr 21, 2015 at 8:09 AM, Ulrich <Fo...@gombers.de> wrote:

> I have already  asked this question
> <
> http://apache-wicket.1842946.n4.nabble.com/Modal-panel-reloaded-when-selecting-from-DropDownChoice-td4670394.html
> >
> but maybe it was off topic there.
>
> The Modal Window provides the method #close(AjaxRequestTarget). But I want
> to provide a Button to validate entered data and display a message in case
> of error otherwise close.
> If I use AjaxSubmitButton() to handle the button the message is not part of
> the target and not updated. I I use Link() the message becomes updated but
> I
> have no means to close the window.
> HTML:
>
>
> Java:
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/How-to-close-a-ModalWindow-without-AjaxRequestTarget-tp4670429.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Regards - Ernesto Reinaldo Barreiro

Re: How to close a ModalWindow without AjaxRequestTarget

Posted by Ulrich <Fo...@gombers.de>.
Thanks a lot; that solved it.

JAVA now (to supply the resuolution for others):


--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-close-a-ModalWindow-without-AjaxRequestTarget-tp4670429p4670439.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: How to close a ModalWindow without AjaxRequestTarget

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

Please read http://wicket.apache.org/guide/guide/ajax.html#ajax_3

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Tue, Apr 21, 2015 at 10:33 AM, Ulrich <Fo...@gombers.de> wrote:

> For the sample I have two buttons to show the coding and to see the results
> of either of them.
> I have no problem closing the window with using AjaxSubmitLink - I don't
> know how to display the message.
>
> Maybe it's easier to see with the complete program:
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/How-to-close-a-ModalWindow-without-AjaxRequestTarget-tp4670429p4670435.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: How to close a ModalWindow without AjaxRequestTarget

Posted by Ulrich <Fo...@gombers.de>.
For the sample I have two buttons to show the coding and to see the results
of either of them.
I have no problem closing the window with using AjaxSubmitLink - I don't
know how to display the message.

Maybe it's easier to see with the complete program:



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-close-a-ModalWindow-without-AjaxRequestTarget-tp4670429p4670435.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: How to close a ModalWindow without AjaxRequestTarget

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

It is not clear why you have two submit buttons in HTML.
I think you need just one - AjaxButton.
It will submit the form via Ajax and if errors occur then its
#onError(AjaxRequestTarget) will be called.
If everything is OK then #onSubmit() will be called.
In both cases you have AjaxRequestTarget around to close the ModalWindow.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Tue, Apr 21, 2015 at 9:09 AM, Ulrich <Fo...@gombers.de> wrote:

> I have already  asked this question
> <
> http://apache-wicket.1842946.n4.nabble.com/Modal-panel-reloaded-when-selecting-from-DropDownChoice-td4670394.html
> >
> but maybe it was off topic there.
>
> The Modal Window provides the method #close(AjaxRequestTarget). But I want
> to provide a Button to validate entered data and display a message in case
> of error otherwise close.
> If I use AjaxSubmitButton() to handle the button the message is not part of
> the target and not updated. I I use Link() the message becomes updated but
> I
> have no means to close the window.
> HTML:
>
>
> Java:
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/How-to-close-a-ModalWindow-without-AjaxRequestTarget-tp4670429.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>