You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Matt Brock <br...@gmail.com> on 2007/12/14 07:47:23 UTC

Re: Tapestry 4.1 -- Asynchronous request with confirm


Abel Marrero Santos wrote:
> 
> I would like to build a @DirectLink which made the request in an
> asynchronous way but request the client with a javascript confirmation
> dialog before the AJAX request. I have tried [...]
> But it didn't work. Even if I click on "OK" or "Cancel" the AJAX action
> takes place.
> 

Couldn't you hide the link with "display: none" and render a dummy link that
calls the onclick handler?  Something like this...


&lt;script&gt;
&nbsp;&nbsp;function confirmBox() {
&nbsp;&nbsp;&nbsp;&nbsp;if (window.confirm('Está seguro que desea borrar
este medio?')) {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;document.getElementById('myComponentId').onclick();
&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;}
&lt;/script&gt;
&lt;span onclick="confirmBox();"&gt;Fake link&lt;/span&gt;
&lt;a jwcid="@DirectLink" listener="listener:doDeleteMedium"
&nbsp;&nbsp;parameters="ognl:medium.id"
&nbsp;&nbsp;async="ognl:true"
&nbsp;&nbsp;updateComponents="mediumList"
&nbsp;&nbsp;id="myComponentId"
&nbsp;&nbsp;style="display: none;"&gt;
&nbsp;&nbsp;&lt;span key="delete"/&gt;
&lt;/a&gt;

-- 
View this message in context: http://www.nabble.com/Tapestry-4.1----Asynchronous-request-with-confirm-tp13900850p14330920.html
Sent from the Tapestry - User mailing list archive at Nabble.com.