You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by HHB <hu...@yahoo.ca> on 2009/06/23 16:47:13 UTC

Getting a JS confirmation when uploading via Ajax

Hey,
I'm uploading a file via Ajax, I literally copied the 
Wicket sample application.
The uploading form is included in a modal window.
Upon clicking on the upload button, I got a JavaScript dialog:
++++++++++++++
Are you sure you want to navigate from this page?
Reloading this page will cause the modal window to disappear.
Press Ok to continue, or Cancel to stay on the current page.
++++++++++++++
Why I'm getting this JavaScript confirmation dialog?
Is there a way to get ride of it?
Thanks.


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


Re: Getting a JS confirmation when uploading via Ajax

Posted by Michael Sparer <mi...@gmx.at>.
I hope you're aware of the fact that File transfer by means of ajax won't
work and you're using something like an iframe.
to get rid of the confirmation, add the following:

		add(new HeaderContributor(new IHeaderContributor() {

			private static final long serialVersionUID = 1L;

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

regards,
Michael

HHB wrote:
> 
> Hey,
> I'm uploading a file via Ajax, I literally copied the 
> Wicket sample application.
> The uploading form is included in a modal window.
> Upon clicking on the upload button, I got a JavaScript dialog:
> ++++++++++++++
> Are you sure you want to navigate from this page?
> Reloading this page will cause the modal window to disappear.
> Press Ok to continue, or Cancel to stay on the current page.
> ++++++++++++++
> Why I'm getting this JavaScript confirmation dialog?
> Is there a way to get ride of it?
> Thanks.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 


-----
Michael Sparer
http://techblog.molindo.at
-- 
View this message in context: http://www.nabble.com/Getting-a-JS-confirmation-when-uploading-via-Ajax-tp24167696p24186854.html
Sent from the Wicket - User 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