Thanks Musachy,
Now I use notifyTopics in the anchor tag instead of onclick with following:
dojo.event.topic.subscribe("/confirmDelete", function(data, type,
request)
{
//cancel request
if ( type == 'before' ) {
if ( !confirm('Do you really want to delete the
entry?') ) {
request.cancel= true;
return false;
}
else {
return true;
}
}
});
This works fine :-)
Thanks a lot!!!
Elisabeth
Musachy Barroso wrote:
>
> Use the notifyTopics attribute, (inside the topic check that the paremeter
> "type" = "before") to pop up the dialog. See the section "Preventing the
> request" here:
>
> http://struts.apache.org/2.x/docs/ajax-tags.html
>
> musachy
>
> On 6/6/07, eschedel <[EMAIL PROTECTED]> wrote:
>>
>>
>> Hi,
>>
>> I have a problem with a delete confirmation of struts2 and ajax. I using
>> following
>> <s:url id="deleteAddressHRef" action="deleteAddress-%{id}"
>> namespace="/businesscontactdata"></s:url>
>> <s:a id="deleteAddressLink" theme="ajax" href="%{deleteAddressHRef}"
>> targets="addresses" onclick="return confirmDelete();">
>> <s:url value= " alt="<s:text name="delete"/>" title="<s:text
>> name="delete"/>"/>
>> </s:a>
>>
>> with the javascript function:
>> <script type="text/javascript">
>> function confirmDelete() {
>> check = confirm('Do you really want to delete the entry?');
>> if ( !check ) {
>> return false;
>> }
>> else {
>> return true;
>> }
>> }
>> </script>
>>
>>
>> I thought that if I didn't confirm the message, the href will not
>> execute.
>> But the action in the href will be execute in any case.
>>
>> Is there anyone who can help me.
>>
>> Many thanks.
>>
>> Bye
>> Elisabeth
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Problem-with-delete-confirmation-and-s%3Aa-with-ajax-tf3878492.html#a10990566
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>
>
> --
> "Hey you! Would you help me to carry the stone?" Pink Floyd
>
>
--
View this message in context:
http://www.nabble.com/Problem-with-delete-confirmation-and-s%3Aa-with-ajax-tf3878492.html#a11061468
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]