[LON-CAPA-cvs] cvs: loncom /publisher lonupload.pm

raeburn lon-capa-cvs@mail.lon-capa.org
Tue, 07 Dec 2004 22:11:02 -0000


raeburn		Tue Dec  7 17:11:02 2004 EDT

  Modified files:              
    /loncom/publisher	lonupload.pm 
  Log:
  Give the form a name to avoid using forms[0].  Remoteless CSTR adds another form before this one, so forms[0].filetype no longer exists.
  
  
Index: loncom/publisher/lonupload.pm
diff -u loncom/publisher/lonupload.pm:1.27 loncom/publisher/lonupload.pm:1.28
--- loncom/publisher/lonupload.pm:1.27	Fri May 14 10:53:31 2004
+++ loncom/publisher/lonupload.pm	Tue Dec  7 17:11:02 2004
@@ -2,7 +2,7 @@
 # The LearningOnline Network with CAPA
 # Handler to upload files into construction space
 #
-# $Id: lonupload.pm,v 1.27 2004/05/14 14:53:31 www Exp $
+# $Id: lonupload.pm,v 1.28 2004/12/07 22:11:02 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -100,7 +100,7 @@
 
 	&Debug($r, "Filename for upload: $fn");
 	if (($fn) && ($fn!~/\/$/)) {
-	    $r->print('<form action="'.$action.'" method="post">'.
+	    $r->print('<form action="'.$action.'" method="post" name="fileupload">'.
 		      '<input type="hidden" name="phase" value="two" />'.
 		      '<input type="hidden" name="datatoken" value="'.
 		      &upfile_store.'" />'.
@@ -258,17 +258,17 @@
     unless ($ENV{'form.phase'} eq 'two') {
         $javascript = qq|
 function verifyForm() {
-    var mode = document.forms[0].filetype.options[document.forms[0].filetype.selectedIndex].value
+    var mode = document.fileupload.filetype.options[document.fileupload.filetype.selectedIndex].value
     if (mode == "testbank") {
-        document.forms[0].action = "/adm/testbank";
+        document.fileupload.action = "/adm/testbank";
     }
     if (mode == "imsimport") {
-        document.forms[0].action = "/adm/imsimport";
+        document.fileupload.action = "/adm/imsimport";
     }
     if (mode == "standard") {
-        document.forms[0].action = "/adm/upload";
+        document.fileupload.action = "/adm/upload";
     }
-    document.forms[0].submit();
+    document.fileupload.submit();
 }
 
 function testbankWin() {