You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by smoothe19 <sa...@justassociates.com> on 2015/04/27 20:56:06 UTC

Generating a popup dialog in OnSubmit()

 protected void onSubmit() {
       if (trainingmode()){
          AjaxRequestTarget target = 
RequestCycle.get().find(AjaxRequestTarget.class);

          MessageDialog dialog = new MessageDialog("dialog", "Notice",
"Decision Matches "  ,
             DialogButtons.OK_CANCEL, DialogIcon.WARN) {

         public void onClose(  AjaxRequestTarget target, DialogButton
button) {

         }
     };
     
     dialog.open(target);
          }

 get an error at dialog.open(target) that says : Caused by:
java.lang.NullPointerException at
com.googlecode.wicket.jquery.ui.widget.dialog.MessageDialog.onOpen(MessageDialog.java:170)
at com.googlecode.wicket.jquery.ui.widget.dialog.AbstractDialog.open(A

I am trying to have an AjaxRequestTarget modal window pop up appear however
i do not have access to AjaxRequestTarget from within the onsubmit()

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Generating-a-popup-dialog-in-OnSubmit-tp4670521.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: Generating a popup dialog in OnSubmit()

Posted by Sebastien <se...@gmail.com>.
Hi,

Right, you don't have any ART in onSubmit(), you should use an ajaxified
component for this (AjaxButton, AjaxLink, etc)
The typical usage of messagedialog, is to construct it during the page
construction (it is hidden by default), attach it (!) and open it
(dialog.open(target)) using the ajax component...

Check out the demo for inspiration...

Hope this helps,
Sebastien.





On Mon, Apr 27, 2015 at 8:56 PM, smoothe19 <sa...@justassociates.com>
wrote:

>  protected void onSubmit() {
>        if (trainingmode()){
>           AjaxRequestTarget target =
> RequestCycle.get().find(AjaxRequestTarget.class);
>
>           MessageDialog dialog = new MessageDialog("dialog", "Notice",
> "Decision Matches "  ,
>              DialogButtons.OK_CANCEL, DialogIcon.WARN) {
>
>          public void onClose(  AjaxRequestTarget target, DialogButton
> button) {
>
>          }
>      };
>
>      dialog.open(target);
>           }
>
>  get an error at dialog.open(target) that says : Caused by:
> java.lang.NullPointerException at
>
> com.googlecode.wicket.jquery.ui.widget.dialog.MessageDialog.onOpen(MessageDialog.java:170)
> at com.googlecode.wicket.jquery.ui.widget.dialog.AbstractDialog.open(A
>
> I am trying to have an AjaxRequestTarget modal window pop up appear however
> i do not have access to AjaxRequestTarget from within the onsubmit()
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Generating-a-popup-dialog-in-OnSubmit-tp4670521.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
>
>