Ernesto , thank you very much, this is great. It should not be too difficult
to change the content (in your example, a Label) to a Panel with buttons for
ok, cancel etc. 

Is it possible with WiQuery to add jQuery code which is to be run before the
dialog opens, and to use the return value from this code to determine
whether or not the dialog opens at all? I have such code working already
with plain javascript, it runs when an AjaxLink is clicked. I would like to
get this working with WiQuery so as to use the look and feel of the dialog.
The alternative presumably is to extend one of the jQuery dialog plugins.

Running the javascript first enables me to bring up a confirmation dialog if
a link is clicked when a wizard is in progress. The wizard creates a hidden
field in a panel, and the javascript can check for the existence and style
of this field to determine if the user is in the middle of a wizard. This is
better than storing a flag in the session, as the back-button could cause
the Wicket session and the page dispalyed to get out of synch.

Here is the code I have now:

@Override
protected IAjaxCallDecorator getAjaxCallDecorator() {
  return new AjaxPreprocessingCallDecorator(super.getAjaxCallDecorator()) { 
     private static final long serialVersionUID = 1L; 

     @Override 
     public CharSequence preDecorateScript(CharSequence script) { 
        String leaveWizardConfirmationMessage = new ResourceModel            
(WIZARD_CANCEL_CONFIRMATION_MESSAGE_TEXT_RESOURCE).getObject();
     
        String javascript = "if
(document.getElementById('"+WIZARD_CANCEL_CONFIRMATION_HIDDEN_FIELD_NAME+"')
"+
           "&&
document.getElementById('"+WIZARD_CANCEL_CONFIRMATION_HIDDEN_FIELD_NAME+"').style.display!='none')"+
           " {if (!confirm('"+leaveWizardConfirmationMessage+"')) return 
false;}";
        return javascript  + script;
     } 
   };
}



-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/WiQuery-Dialog-when-used-with-Ajax-tp3009441p3009910.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to