--- loncom/homework/edit.pm	2005/12/15 23:20:55	1.98
+++ loncom/homework/edit.pm	2005/12/22 22:06:54	1.99
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # edit mode helpers
 #
-# $Id: edit.pm,v 1.98 2005/12/15 23:20:55 albertel Exp $
+# $Id: edit.pm,v 1.99 2005/12/22 22:06:54 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -504,11 +504,14 @@ sub js_change_detection {
 <script type="text/javascript">
 var clean = true;
 var is_submit = false;
+var still_ask = false;
 function compareForm(event_) {
         if (!event_ && window.event) {
           event_ = window.event;
         }
-	if (!is_submit && !clean) {
+	if ((!is_submit || (is_submit && still_ask)) && !clean) {
+	    still_ask = false;
+	    is_submit = false;
             event_.returnValue = "$unsaved";
             return "$unsaved";
         }
@@ -529,6 +532,10 @@ sub element_change_detection {
     return ' onchange="unClean();" ';
 }
 
+sub submit_ask_anyway {
+    return ' onclick="still_ask=true;" ';
+}
+
 sub textarea_sizes {
     my ($data)=@_;
     my $count=0;