You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Abel Marrero Santos <ma...@uh.cu> on 2007/11/22 18:54:34 UTC
Tapestry 4.1 -- Asynchronous request with confirm
Hi:
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 to make something like:
<a jwcid="@DirectLink" listener="listener:doDeleteMedium"
parameters="ognl:medium.id"
async="ognl:true"
updateComponents="mediumList"
onclick="javascript:return window.confirm('Está seguro que
desea borrar este medio?');"><span key="delete"/></a>
But it didn't work. Even if I click on "OK" or "Cancel" the AJAX action
takes place.
Some help please?
Thanks,
Abel.
Re: Tapestry 4.1 -- Asynchronous request with confirm
Posted by Matt Brock <br...@gmail.com>.
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...
<script>
function confirmBox() {
if (window.confirm('Está seguro que desea borrar
este medio?')) {
document.getElementById('myComponentId').onclick();
}
}
</script>
<span onclick="confirmBox();">Fake link</span>
<a jwcid="@DirectLink" listener="listener:doDeleteMedium"
parameters="ognl:medium.id"
async="ognl:true"
updateComponents="mediumList"
id="myComponentId"
style="display: none;">
<span key="delete"/>
</a>
--
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.