Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
459
save changes on exiting the application
posted

how can i prevent the user to close the webapplication (x in internet explorer) without saving the changes in the ultrawebgrid?

elke

Parents
No Data
Reply
  • 100
    posted

     try it, but it only worked in IE:

    <html>
    <head>
    <body  onBeforeUnLoad="clean_exit(this)"  >
    something else........

    <script language="JavaScript">  
    var changes=false;
    var problems=false;
     
    function clean_exit( src ){
          verify();  
          if (problems){
                alert ("problems: " + problems);
                // the verify routine reports problems, don't allow an exit or reloading of the page
          }else{
                // no problems, so continue
                if(changes){        
                      if (!confirm("You have made changes.  Click OK to save, or cancel to continue without saving")){
                            return false;  
                      }else{
                            //do something  
                            return true;
                      }  // end of confirm
                } // end of changes
          }// end of verify
    }

    function changed(){    
          changes=true;
    }
     
    function verify(){    
          var problems=false;
          with (Entry) {
                if (LastName.value == "") {  
                      problems=true;
                      return false;
                }
          }
          changes=false;
          return true;
    }  
    </script>
    </body>
    </html>


     

Children