Figured this out.

Setting the unloadConfirmation to false here is useless, because Wicket only
examines that boolean in its show() method for the modal, at which point it
sets up unload event handlers based on true/false.

That event handler is already set by this point, so changing the boolean
here is too late.

To work around this, I had to actually redefine the window.onunload myself
to replace Wicket's handler.

This seems to work.

A better fix might be to alter the unload event handler which does the
warning to first check the value of the boolean, in case the user has reset
it, and if the user has reset it, skip the warning.


dukejansen wrote:
> 
> Tried this. It still gives the warning. :(
> 
> 
> James McLaughlin-3 wrote:
>> 
>> Its a shameless hack, but you could try it in a setTimeout.  Or possibly,
>> target.appendJavascript("Wicket.Window.unloadConfirmation=false;window.location.reload()")
>> Otherwise, I believe the semantics of onClose make it necessary for
>> the modal to be around until onClose returns.
>> 
>> hth,
>> 
>> jim
>> 
>> On 5/31/07, dukejansen <[EMAIL PROTECTED]> wrote:
>>>
>>> Any chance anyone has any input on this? I still think this is a bug in
>>> Wicket, that I can't set Javascript to reload the page after the modal
>>> window is closed, since the page still thinks the modal is open.
>>>
>>>
>>> dukejansen wrote:
>>> >
>>> > Yup. That's why I was trying to do it using
>>> > target.appendJavascript("window.location.reload()") instead of doing
>>> the
>>> > setResponsePage server side...? Since I'm appending that Javascript
>>> AFTER
>>> > the 'close modal window' call, it seems like it should be able to
>>> close
>>> > the modal window client side, THEN call my javascript to refresh the
>>> page,
>>> > without the warning, since the modal has been closed.. ?
>>> >
>>> >
>>> > Matej Knopp-2 wrote:
>>> >>
>>> >> The problem is that when setResponsePage() is called, no appended
>>> >> Javascript is evaluated. In fact, wicket doesn't process the ajax
>>> >> response at all. Just sets window.location.
>>> >>
>>> >> -Matej
>>> >>
>>> >> On 5/9/07, dukejansen <[EMAIL PROTECTED]> wrote:
>>> >>>
>>> >>> Yeah, but I don't want to disable that warning. That warning is
>>> valid if
>>> >>> the
>>> >>> user really does try to navigate away while the modal is still being
>>> >>> displayed.
>>> >>>
>>> >>> The problem is that I am actually closing the modal before I do the
>>> >>> redirect, so it shouldn't show the warning at all.
>>> >>>
>>> >>> -Jason
>>> >>>
>>> >>>
>>> >>> Matej Knopp-2 wrote:
>>> >>> >
>>> >>> > There is a way that should also work in recent 1.x. To disable the
>>> >>> > confirmation dialog you need to put this inside the page with
>>> modal
>>> >>> > window:
>>> >>> > <script type="text/javascript">
>>> >>> >   Wicket.Window.unloadConfirmation=false;
>>> >>> > </script>
>>> >>> >
>>> >>> > -Matej
>>> >>> >
>>> >>> > On 5/9/07, Arnout Engelen <[EMAIL PROTECTED]> wrote:
>>> >>> >> dukejansen schreef:
>>> >>> >> > My Ajax event handler needs to first close the current modal
>>> window
>>> >>> and
>>> >>> >> then refresh the entire page. Is there a better way to do this?
>>> >>> >> >
>>> >>> >> I once worked around something like this by putting the redirect
>>> in
>>> >>> the
>>> >>> >> windowClosedCallback of the ModalWindow. That was sufficient in
>>> our
>>> >>> >> case, but I too would be interested in some more enlightenment in
>>> >>> this
>>> >>> >> area :).
>>> >>> >>
>>> >>> >>
>>> >>> >> Arnout
>>> >>> >>
>>> >>> >>
>>> >>>
>>> -------------------------------------------------------------------------
>>> >>> >> This SF.net email is sponsored by DB2 Express
>>> >>> >> Download DB2 Express C - the FREE version of DB2 express and take
>>> >>> >> control of your XML. No limits. Just data. Click to get it now.
>>> >>> >> http://sourceforge.net/powerbar/db2/
>>> >>> >> _______________________________________________
>>> >>> >> Wicket-user mailing list
>>> >>> >> Wicket-user@lists.sourceforge.net
>>> >>> >> https://lists.sourceforge.net/lists/listinfo/wicket-user
>>> >>> >>
>>> >>> >
>>> >>> >
>>> >>>
>>> -------------------------------------------------------------------------
>>> >>> > This SF.net email is sponsored by DB2 Express
>>> >>> > Download DB2 Express C - the FREE version of DB2 express and take
>>> >>> > control of your XML. No limits. Just data. Click to get it now.
>>> >>> > http://sourceforge.net/powerbar/db2/
>>> >>> > _______________________________________________
>>> >>> > Wicket-user mailing list
>>> >>> > Wicket-user@lists.sourceforge.net
>>> >>> > https://lists.sourceforge.net/lists/listinfo/wicket-user
>>> >>> >
>>> >>> >
>>> >>>
>>> >>> --
>>> >>> View this message in context:
>>> >>>
>>> http://www.nabble.com/Force-page-refresh-after-Ajax-request-completes--tf3714279.html#a10400468
>>> >>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>> >>>
>>> >>>
>>> >>>
>>> -------------------------------------------------------------------------
>>> >>> This SF.net email is sponsored by DB2 Express
>>> >>> Download DB2 Express C - the FREE version of DB2 express and take
>>> >>> control of your XML. No limits. Just data. Click to get it now.
>>> >>> http://sourceforge.net/powerbar/db2/
>>> >>> _______________________________________________
>>> >>> Wicket-user mailing list
>>> >>> Wicket-user@lists.sourceforge.net
>>> >>> https://lists.sourceforge.net/lists/listinfo/wicket-user
>>> >>>
>>> >>
>>> >>
>>> -------------------------------------------------------------------------
>>> >> This SF.net email is sponsored by DB2 Express
>>> >> Download DB2 Express C - the FREE version of DB2 express and take
>>> >> control of your XML. No limits. Just data. Click to get it now.
>>> >> http://sourceforge.net/powerbar/db2/
>>> >> _______________________________________________
>>> >> Wicket-user mailing list
>>> >> Wicket-user@lists.sourceforge.net
>>> >> https://lists.sourceforge.net/lists/listinfo/wicket-user
>>> >>
>>> >>
>>> >
>>> >
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Force-page-refresh-after-Ajax-request-completes--tf3714279.html#a10897058
>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>
>>>
>>> -------------------------------------------------------------------------
>>> This SF.net email is sponsored by DB2 Express
>>> Download DB2 Express C - the FREE version of DB2 express and take
>>> control of your XML. No limits. Just data. Click to get it now.
>>> http://sourceforge.net/powerbar/db2/
>>> _______________________________________________
>>> Wicket-user mailing list
>>> Wicket-user@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/wicket-user
>>>
>> 
>> -------------------------------------------------------------------------
>> This SF.net email is sponsored by DB2 Express
>> Download DB2 Express C - the FREE version of DB2 express and take
>> control of your XML. No limits. Just data. Click to get it now.
>> http://sourceforge.net/powerbar/db2/
>> _______________________________________________
>> Wicket-user mailing list
>> Wicket-user@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/wicket-user
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Force-page-refresh-after-Ajax-request-completes--tf3714279.html#a11349738
Sent from the Wicket - User mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to