Quantcast
Channel: West Wind Message Board Messages
Viewing all articles
Browse latest Browse all 10393

Re: How to Request Confirmation before deleting

$
0
0
Re: How to Request Confirmation before deleting
Web Connection 5.0
Re: How to Request Confirmation before deleting
Apr. 8, 2013
03:37 pm
3R90XHD15Show this entire thread in new window
Gratar Image based on email address
From:Geoff Bannoff
To:Ray
Hi Ray

I add this little bit of Javascript at the bottom of the web page:

<script language="JavaScript">function OK() { if (! confirm("Really delete this document?")) { returnfalse; } returntrue; };</script>

Here is the code for the delete button:

<ww:wwWebButtonID="btnDelete"runat="server"Text="Delete this document" onClientClick="return OK();" click="btnDelete_click" />

It works reliably.

Cheers
.. Geoff



I have a java script that prompts for confirmation before a delete but the webbutton always does the click event. The doc's say returning a false from the script will prevent the click event but it always fires for me. The script pops up and returns either true or false.

From the doc's:
"If you use OnClientClick() on a submit button the button will still submit the form unless you return false from your JavaScript handler. "


Is there another way to make this work?


Thanks

Ray

<ww:wwWebButtonID="btnSubmitDelete"runat="server"name="btnSubmitDelete" onclientclick="ConfirmDelete()" Click="btnSubmitDelete_Material_Click"Text="Delete" />

<code lang = "javascript">

<script>
function ConfirmDelete() {
var r = confirm("Are you sure you want to Delete this Entry?");
if (r == true) {
return true;

}
else {
return false;
}
}
</script>



Viewing all articles
Browse latest Browse all 10393