title: Create confirm JavaScript for when users try to leave page without saving
body: <p>I am trying to make it so that if a user makes changes to a page and then tries to leave the page without saving, a popup message will appear with an "OK" button (no "Cancel" button). Clicking the "OK" button, closes the message. The user must click the "Save" button or they will keep getting the message, prohibiting them from leaving the page until the "Save" button is clicked. By leave the page, I mean keeping them from navigating to another tab or menu item within the site...if they click any other link on the page, it would give them the popup. They can leave they site at anytime.</p>
  
  <p>I am thinking I need JavaScript modal dialog to get rid of the Cancel button but am a bit uncertain of the implementation. </p>
  
  <p>Currently, I am using r = confirm (see below) but it has the cancel button plus it gives the option for users to leave the page if they click "OK". I do not want them to be able to leave the page without clicking the "Save" button or they would have to close the entire window. </p>
  
  <p>Any help/explanation is very much appreciated as I am very new to this. Thank you.</p>
  
  <pre><code>if (typeof unsaved != 'undefined') {
  if (unsaved == true) {
  var r = confirm("Please click Update. Unsaved changes will be lost.");
  if (r == false) {
       saveNeeded = "true";
       }
       else { saveNeeded = "false"; }
   }
  }
  </code></pre>