Re: Get return value of ajax event in Wicket 6.9.1

2013-11-14 Thread Daniela L
Hi, now everything works perfect, thank you I am so happy. Best Regards Daniela 2013/11/14 Martin Grigorov mgrigo...@apache.org Hi, mySubmitButton.add(AttributeAppender.append(onclick, window.dontAsk = true; return true;)) response.render(new OnDomReadyHeaderItem(window.onbeforeunload =

Re: Get return value of ajax event in Wicket 6.9.1

2013-11-13 Thread Daniela L
Hi, I have another problem regarding this question. Now every time the page is left the message Do you want to leave the page is popping up, but when the user correctly fills the form on the page and hits the submit button he should be redirected to another page showing the result of his input. I

Re: Get return value of ajax event in Wicket 6.9.1

2013-11-13 Thread Martin Grigorov
Hi, #onSubmit() would be called after the user agrees to leave the page. You can set some JS variable/flag when the submit button is used and depending on this flag do not ask for confirmation in onbeforerender. On Wed, Nov 13, 2013 at 10:02 AM, Daniela L danigal...@gmail.com wrote: Hi, I

Re: Get return value of ajax event in Wicket 6.9.1

2013-11-13 Thread Daniela L
Hi, I am sorry I don't get it. How and when to set the JS variable? Like this: mySubmitButton.add(new AjaxEventBehavior(onclick) { @Override protected void onEvent(AjaxRequestTarget target) { AjaxRequestAttributes ajaxRequestAttributes = new

Re: Get return value of ajax event in Wicket 6.9.1

2013-11-13 Thread Martin Grigorov
Hi, mySubmitButton.add(AttributeAppender.append(onclick, window.dontAsk = true; return true;)) response.render(new OnDomReadyHeaderItem(window.onbeforeunload = function (e) { + if (!window.dontAsk) { + + var message = 'Your confirmation message goes

Re: Get return value of ajax event in Wicket 6.9.1

2013-11-12 Thread Daniela L
Hi, thank you so much for your help this works fantastic. I am so happy I was trying around with this for days :-) 2013/11/11 Martin Grigorov mgrigo...@apache.org respond() is the callback method that Wicket will notify. But you need to trigger an Ajax call first. This is done with the Wicket

Get return value of ajax event in Wicket 6.9.1

2013-11-11 Thread Daniela L
Hi, this is my first question, so i hope I get everything right. I am trying to catch the event of the user closing the browser window in wicket. I followed this example: http://stackoverflow.com/questions/16527463/call-java-component-from-javascript-and-retreive-value and I managed to get the

Re: Get return value of ajax event in Wicket 6.9.1

2013-11-11 Thread Martin Grigorov
Hi, You need to make an Ajax call to the server. On Mon, Nov 11, 2013 at 2:10 PM, Daniela L danigal...@gmail.com wrote: Hi, this is my first question, so i hope I get everything right. I am trying to catch the event of the user closing the browser window in wicket. I followed this

Re: Get return value of ajax event in Wicket 6.9.1

2013-11-11 Thread Daniela L
Hi, as far as I have understood this can only be achieved, if I subclass AbstractDefaultAjaxBehavior like this? public class PageExitWarningBehavior extends AbstractDefaultAjaxBehavior { @Override protected void respond(AjaxRequestTarget target) {

Re: Get return value of ajax event in Wicket 6.9.1

2013-11-11 Thread Daniela L
Hi, I have tryed to change to AbstractDefaultAjaxBehavior like I described below, but respond is never called. What am I doing wrong? Hi, as far as I have understood this can only be achieved, if I subclass AbstractDefaultAjaxBehavior like this? public class PageExitWarningBehavior extends

Re: Get return value of ajax event in Wicket 6.9.1

2013-11-11 Thread Martin Grigorov
Did you do what I suggested you ? On Mon, Nov 11, 2013 at 3:49 PM, Daniela L danigal...@gmail.com wrote: Hi, I have tryed to change to AbstractDefaultAjaxBehavior like I described below, but respond is never called. What am I doing wrong? Hi, as far as I have understood this can only

Re: Get return value of ajax event in Wicket 6.9.1

2013-11-11 Thread Daniela L
I thought adding respond was the ajax call to the server, am I wrong? I didn't work much with ajax, i am sorry 2013/11/11 Martin Grigorov mgrigo...@apache.org Did you do what I suggested you ? On Mon, Nov 11, 2013 at 3:49 PM, Daniela L danigal...@gmail.com wrote: Hi, I have tryed to

Re: Get return value of ajax event in Wicket 6.9.1

2013-11-11 Thread Martin Grigorov
respond() is the callback method that Wicket will notify. But you need to trigger an Ajax call first. This is done with the Wicket Ajax API: Wicket.Ajax.get(...). Just try with the line I've added in your JS code On Mon, Nov 11, 2013 at 4:04 PM, Daniela L danigal...@gmail.com wrote: I thought

Re: Get return value of ajax event in Wicket 6.9.1

2013-11-11 Thread Cedric Gatay
AFAIK the browser won't issue a new server call (or will not process the response) once the onunload event has been called so I doubt this will work (using the web inspector of your browser will allow you to check whether or not the call has been done) I second what Martin said, you need to add

Re: Get return value of ajax event in Wicket 6.9.1

2013-11-11 Thread Martin Grigorov
There is a difference between onunload and onbeforeunload. You can cancel the latter. You can make Ajax call only in onbeforeunload. And it has to be synchronous. On Mon, Nov 11, 2013 at 4:55 PM, Cedric Gatay gata...@gmail.com wrote: AFAIK the browser won't issue a new server call (or will not

Re: Get return value of ajax event in Wicket 6.9.1

2013-11-11 Thread Cedric Gatay
I was on my phone and didn't read that well the provided snippet, it should work fine then ;) __ Cedric Gatay (@Cedric_Gatay http://twitter.com/Cedric_Gatay) http://code-troopers.com | http://www.bloggure.info | http://cedric.gatay.fr On Mon, Nov 11, 2013 at 4:05 PM, Martin Grigorov