[LON-CAPA-cvs] cvs: loncom /homework inputtags.pm structuretags.pm

raeburn raeburn at source.lon-capa.org
Tue Mar 10 19:11:23 EDT 2015


raeburn		Tue Mar 10 23:11:23 2015 EDT

  Modified files:              
    /loncom/homework	inputtags.pm structuretags.pm 
  Log:
  - Inhibit auto-completion for input textboxes using javascript instead of 
    attribute hard coded within input tag so page satisfies w3c validation (HTML4) 
  
  
Index: loncom/homework/inputtags.pm
diff -u loncom/homework/inputtags.pm:1.330 loncom/homework/inputtags.pm:1.331
--- loncom/homework/inputtags.pm:1.330	Sat Feb 21 21:53:34 2015
+++ loncom/homework/inputtags.pm	Tue Mar 10 23:11:22 2015
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # input  definitons
 #
-# $Id: inputtags.pm,v 1.330 2015/02/21 21:53:34 raeburn Exp $
+# $Id: inputtags.pm,v 1.331 2015/03/10 23:11:22 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -464,12 +464,11 @@
 		    $name = "none";
 		}
 		$result.= '<input onkeydown="javascript:setSubmittedPart(\''.$partid.'\');"'
-		     . ' type="text" '
-		     . $readonly.' name="'. $name . '"'
+		     . ' onfocus="javascript:disableAutoComplete(\''.$itemid.'\');"'
+		     . ' type="text" '.$readonly.' name="'. $name . '"'
 		     . ' id="' . $itemid . '"'
 		     . ' value="'.  $oldresponse.'"'
-		     . ' class="LC_textline spellchecked"  size="'.$size.'"'.$maxlength
-		     . ' autocomplete="off" />';
+		     . ' class="LC_textline spellchecked"  size="'.$size.'"'.$maxlength.' />';
 
 		$result .= &spellcheck_onblur($itemid, $spellcheck);
 	    }
Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.531 loncom/homework/structuretags.pm:1.532
--- loncom/homework/structuretags.pm:1.531	Sat Mar  7 23:13:09 2015
+++ loncom/homework/structuretags.pm	Tue Mar 10 23:11:22 2015
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: structuretags.pm,v 1.531 2015/03/07 23:13:09 raeburn Exp $
+# $Id: structuretags.pm,v 1.532 2015/03/10 23:11:22 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -287,6 +287,17 @@
     }
 }
 
+function disableAutoComplete (id) {
+    var field = document.getElementById(id);
+    if (field != null && field != undefined){
+        if ('autocomplete' in field) {
+            field.autocomplete = "off";
+        } else {
+            field.setAttribute("autocomplete", "off");
+        }
+    }
+}
+
 function image_response_click (which, e) {
     init_geometry();
     if (!e) { e = window.event; } //IE




More information about the LON-CAPA-cvs mailing list