]> git.mjollnir.org Git - moodle.git/commitdiff
Fix minor HTML validation issue.
authortjhunt <tjhunt>
Thu, 10 Aug 2006 18:58:26 +0000 (18:58 +0000)
committertjhunt <tjhunt>
Thu, 10 Aug 2006 18:58:26 +0000 (18:58 +0000)
lib/weblib.php

index 09a164d2465cec81b73a132f6a44b82c5a3453ce..632f548b77d9f7dc81545683add37dd4f9d6751f 100644 (file)
@@ -718,7 +718,8 @@ function choose_from_menu ($options, $name, $selected='', $nothing='choose', $sc
         $attributes .= ' tabindex="'.$tabindex.'"';
     }
 
-    $output = '<select id="menu'.$name.'" name="'. $name .'" '. $attributes .'>' . "\n";
+    $id = str_replace('[]', '', $name); // name may end in [], which would make an invalid id. e.g. numeric question type editing form.
+    $output = '<select id="menu'.$id.'" name="'. $name .'" '. $attributes .'>' . "\n";
     if ($nothing) {
         $output .= '   <option value="'. $nothingvalue .'"'. "\n";
         if ($nothingvalue === $selected) {