How to display a confirmation dialog
Created Mar 17, 2003
Ted Husted Generally, the simplest thing is to just have the JavaScript window popup. If they click no, just close the window. If they click yes, then submit the request. If they cannot submit the logout request without clicking yes, then you don't need to disable anything.
Where "bCancel" is the JavaScript variable used by the Validator tag.
I would not recommend disabling the button if they click no, since they might change their mind.
In my own applications, I just do something like this:
<SCRIPT language="JavaScript">
<!--
function create() {
var go = confirm("Are you sure?");
if (go == true) {
bCancel=false;
set("create");
return true;
}
else {
return false;
}
}
//-->
</SCRIPT>
Where "bCancel" is the JavaScript variable used by the Validator tag.
HTH, Ted.
---
Struts in Action