Thank you all for replying It does sound like I'm trying to do something impossible, but I would like to post my code here in case i did not explain the problem correctly:
I add onbeforeunload event to the body of my page, which calls a JS function. The JS does submit to my form. In my form onSubmit() I do a setResponsePage. I see that it get's into the onSubmit() (and even to the destination page's constructor), but after exit from onSubmit(), it returns to the original page (refereshing the entered data). Here's the code: on page -------- body.add(new SimpleAttributeModifier("onload", "isSubmit=false;")); StringBuilder js = new StringBuilder(); js.append("if(!isSubmit){checkLeaving( '"); js.append(getString("leaveWizardMessage")); js.append("', '"); js.append(newAccountWizard.getForm().getMarkupId()); js.append("', '"); js.append(newAccountWizard.getConfirmationModal().getMarkupId()); js.append("')};"); body.add(new SimpleAttributeModifier("onbeforeunload", js.toString())); add(body); js file -------- function checkLeaving(message, formId, modalId, linkId){ //alert("formId = " + formId); var answer = confirm(message); if(answer == true){ var form = document.getElementById(formId); //var modal = document.getElementById(modalId); //var submitLink = document.getElementById(linkId); alert("before submit"); form.submit(); //submitLink.onclick(); //return false; } } wizard panel ------------- @Override protected Form newForm(String id) { form = new Form(id){ @Override protected void onSubmit() { System.out.println("in form submit1"); setResponsePage(NewAccountRegistrationPage.class); System.out.println("in form submit2"); } protected void onError() { System.out.println("in form error"); }; }; Can someone please tell me if it's possible? Rebbaca -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/warn-on-exit-from-browser-tp3516569p3534945.html Sent from the Users forum 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