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) {
   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

0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact