[LON-CAPA-cvs] cvs: loncom /interface lonhtmlcommon.pm

matthew lon-capa-cvs@mail.lon-capa.org
Fri, 11 Jul 2003 16:07:20 -0000


matthew		Fri Jul 11 12:07:20 2003 EDT

  Modified files:              
    /loncom/interface	lonhtmlcommon.pm 
  Log:
  Added 'onchange' parameter to StatusOptions.
  
  
Index: loncom/interface/lonhtmlcommon.pm
diff -u loncom/interface/lonhtmlcommon.pm:1.26 loncom/interface/lonhtmlcommon.pm:1.27
--- loncom/interface/lonhtmlcommon.pm:1.26	Fri Jun 20 12:13:06 2003
+++ loncom/interface/lonhtmlcommon.pm	Fri Jul 11 12:07:20 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common html routines
 #
-# $Id: lonhtmlcommon.pm,v 1.26 2003/06/20 16:13:06 matthew Exp $
+# $Id: lonhtmlcommon.pm,v 1.27 2003/07/11 16:07:20 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -385,6 +385,9 @@
 
 $size: the size (number of lines) of the selection box.
 
+$onchange: javascript to use when the value is changed.  Enclosed in 
+double quotes, ""s, not single quotes.
+
 Returns: a perl string as described.
 
 =cut
@@ -392,7 +395,7 @@
 ##############################################
 ##############################################
 sub StatusOptions {
-    my ($status, $formName,$size)=@_;
+    my ($status, $formName,$size,$onchange)=@_;
     $size = 1 if (!defined($size));
     if (! defined($status)) {
         $status = 'Active';
@@ -409,8 +412,11 @@
 
     my $Str = '';
     $Str .= '<select name="Status"';
-    if(defined($formName) && $formName ne '') {
+    if(defined($formName) && $formName ne '' && ! defined($onchange)) {
         $Str .= ' onchange="document.'.$formName.'.submit()"';
+    }
+    if (defined($onchange)) {
+        $Str .= ' onchange="'.$onchange.'"';
     }
     $Str .= ' size="'.$size.'" ';
     $Str .= '>'."\n";