RT#7812: confirm before closing quick payment entry
[freeside.git] / httemplate / misc / batch-cust_pay.html
index e10a5f6..505f2d0 100644 (file)
@@ -2,7 +2,20 @@
 
 <% include('/elements/error.html') %>
 
-<FORM ACTION="process/batch-cust_pay.cgi" NAME="OneTrueForm" METHOD="POST" onsubmit="document.OneTrueForm.submit.disabled=true;">
+<SCRIPT TYPE="text/javascript">
+function warnUnload() {
+  if(document.getElementById("OneTrueTable").rows.length > 3 &&
+     !document.OneTrueForm.submit.disabled) {
+    return "The current batch will be lost.";
+  }
+  else {
+    return null;
+  }
+}
+window.onbeforeunload = warnUnload;
+</SCRIPT>
+
+<FORM ACTION="process/batch-cust_pay.cgi" NAME="OneTrueForm" METHOD="POST" onsubmit="document.OneTrueForm.submit.disabled=true;window.onbeforeunload = null;">
 
 <!-- <B>Batch</B> <INPUT TYPE="text" NAME="paybatch"><BR><BR> -->