How to display a confirmation dialog

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.

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) {
   return true;
 else {
  return false;

Where "bCancel" is the JavaScript variable used by the Validator tag.

HTH, Ted.
Struts in Action