Wouldn't it make sense to disable this confirmation dialog in deployment mode?

What is it good for anyway?

Am 12.09.2009 um 14:50 schrieb Mikko Pukki:

Hi,

I wouldn't mess around with such scripts unless really necessary. Mainly, because Wicket can handle domreadyEvents on its own. I solved the problem by extending ModalWindow and by adding a behavior that disables the unloadConfirmation. Like this:


public MyModalWindow(String id, IModel title, int initialHeight, int initialWidth)
        {
                super(id);

                setTitle(title);

                add(new DisableDefaultConfirmBehavior());
....

private class DisableDefaultConfirmBehavior extends AbstractBehavior implements IHeaderContributor {

                private static final long       serialVersionUID        = 1L;

                @Override
                public void renderHead(IHeaderResponse response)
                {
response.renderOnDomReadyJavascript ("Wicket.Window.unloadConfirmation = false");
                }

        }

Of course, when having multiple Modal windows on the same page, that script would fire multiple times, but then again, would it be a good idea to have multiple modal windows in the first place?

- Mikko


-----Original Message-----
From: Vladimir K [mailto:koval...@gmail.com]
Sent: 12. syyskuuta 2009 9:37
To: users@wicket.apache.org
Subject: Re: How to redirect from a ModalWindow


Try adding this one to the page markup

                <script language="javascript" type="text/javascript">
                        jQuery(document).ready(function(){
                                if (typeof Wicket != 'undefined' && 
Wicket.Window)
                                        Wicket.Window.unloadConfirmation = 
false;
                        });
                </script>


Matthias Keller wrote:

Hi Peter

You would be right as long as it wasn't for a ModalWindow.
When having an open ModalWindow, wicket seems to register an unload
javascript event which - when trying to navigate away from the page (be it by following a link, closing the window etc), displays a confirmation message which you have to accept. I need to avoid that message, but the only way to do that probably is by closing that window first so that the
javascript event gets unloaded.

Matt

Peter Ertl wrote:


   throw new RestartResponseException(OtherPage.class)

window.close() is not needed!


Am 10.09.2009 um 12:50 schrieb Matthias Keller:

OtherPage.class


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






--
View this message in context: 
http://www.nabble.com/How-to-redirect-from-a-ModalWindow-tp25381117p25411990.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


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


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

Reply via email to