You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by drf <da...@gmail.com> on 2010/10/20 13:45:59 UTC

Re: Confirmation dialog

I am having a problem when using IAjaxDecorator as described.
In the predecorate method, I have:

return "if(test-variable) return confirm('text');" + script;

The confirm button appears, but even on clicking 'OK', it looks as if false
is getting returned every time, because the code in
onClick(AjaxRequestTarget) is not getting called.

Perhaps there is something wrong with my basic synatx, because normal
processing does not continue even after the following:
return "if (1==1) {return true;} else {return true;}" + script;

Help is truly appreciated !!!


-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Confirmation-dialog-tp1844404p3003697.html
Sent from the Users forum 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


RE: Confirmation dialog

Posted by "Hill, Joel (DTMB)" <Hi...@michigan.gov>.
The problem in your first example is "return confirm('text');"  Once you dismiss the confirm dialog, no matter which button you click, the javascript returns.  Same with your second example.  You hit a return statement before the Ajax script gets executed.

Your third example works, because if you hit OK, the JS processing continues and executes the Ajax script.  If you hit cancel, confirm() returns false, thus executing the return statement and skipping the Ajax script.  (Assuming the variable 'test' is true, if 'test' is false, the confirm dialog shouldn't even appear at all and the Ajax script will get just get executed.)

Hope that helps.

Joel

-----Original Message-----
From: drf [mailto:davidrfield@gmail.com] 
Sent: Wednesday, October 20, 2010 8:26 AM
To: users@wicket.apache.org
Subject: Re: Confirmation dialog


Do not know what my mistake is in the previous example, but this works:
return "if (test) {if (!confirm('TEXT')) return false;}" + script;
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Confirmation-dialog-tp1844404p3003762.html
Sent from the Users forum 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


Re: Confirmation dialog

Posted by drf <da...@gmail.com>.
Do not know what my mistake is in the previous example, but this works:
return "if (test) {if (!confirm('TEXT')) return false;}" + script;
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Confirmation-dialog-tp1844404p3003762.html
Sent from the Users forum 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