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

bowersj2 lon-capa-cvs@mail.lon-capa.org
Sat, 01 Mar 2003 00:07:18 -0000


bowersj2		Fri Feb 28 19:07:18 2003 EDT

  Modified files:              
    /loncom/interface	lonwizard.pm 
  Log:
  Ensure that the first resource or choice is checked when showing
  radio buttons.
  
  
Index: loncom/interface/lonwizard.pm
diff -u loncom/interface/lonwizard.pm:1.16 loncom/interface/lonwizard.pm:1.17
--- loncom/interface/lonwizard.pm:1.16	Fri Feb 28 18:47:37 2003
+++ loncom/interface/lonwizard.pm	Fri Feb 28 19:07:18 2003
@@ -806,7 +806,7 @@
 	$result .= "<tr>\n<td width='20'>&nbsp;</td>\n<td>";
 	$result .= "<td valign=\"top\"><input type=\"radio\" name=\"$var.forminput\"";
         if (!$checked) {
-            $result .= " selected";
+            $result .= " checked";
             $checked = 1;
         }
 	$result .= " value=\"$value\"></td>\n<td>$text</td>\n</tr>\n\n";
@@ -1266,6 +1266,7 @@
     # Create the composite function that renders the column on the nav map
     # have to admit any language that lets me do this can't be all bad
     #  - Jeremy (Pythonista) ;-)
+    my $checked = 0;
     my $renderColFunc = sub {
         my ($resource, $part, $params) = @_;
         
@@ -1273,8 +1274,9 @@
             return '<td>&nbsp;</td>';
         } else {
             my $col = "<td><input type='radio' name='${var}.forminput' ";
-            if ($vals->{$resource->{ID}}) {
+            if (!$checked) {
                 $col .= "checked ";
+                $checked = 1;
             }
             $col .= "value='" . $resource->{ID} . "' /></td>";
             return $col;