]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-7861 Strict XHTML 1.0 - popup_form() fixes (added div and $formname parameter...
authorskodak <skodak>
Wed, 3 Jan 2007 18:53:03 +0000 (18:53 +0000)
committerskodak <skodak>
Wed, 3 Jan 2007 18:53:03 +0000 (18:53 +0000)
lib/weblib.php

index c6c614e4f46c6aa8b8c62114596ba5b8dd86c941..9f4184ea1e612223a4f0500ea4f3224a2d22fae3 100644 (file)
@@ -919,7 +919,7 @@ function print_textfield ($name, $value, $alt = '',$size=50,$maxlength=0, $retur
  * @uses $CFG
  * @param string $common  The URL up to the point of the variable that changes
  * @param array $options  Alist of value-label pairs for the popup list
- * @param string $formname Name must be unique on the page
+ * @param string $formid Id must be unique on the page (originaly $formname)
  * @param string $selected The option that is already selected
  * @param string $nothing The label for the "no choice" option
  * @param string $help The name of a help page if help is required
@@ -930,7 +930,7 @@ function print_textfield ($name, $value, $alt = '',$size=50,$maxlength=0, $retur
  * @return string If $return is true then the entire form is returned as a string.
  * @todo Finish documenting this function<br>
  */
-function popup_form($common, $options, $formname, $selected='', $nothing='choose', $help='', $helptext='', $return=false, $targetwindow='self') {
+function popup_form($common, $options, $formid, $selected='', $nothing='choose', $help='', $helptext='', $return=false, $targetwindow='self') {
 
     global $CFG;
     static $go, $choose;   /// Locally cached, in case there's lots on a page
@@ -955,11 +955,10 @@ function popup_form($common, $options, $formname, $selected='', $nothing='choose
     $startoutput = '<form action="'.$CFG->wwwroot.'/course/jumpto.php"'.
                         ' method="get"'.
                         ' target="'.$CFG->framename.'"'.
-                        ' name="'.$formname.'"'.
-                        ' id="'.$formname.'"'.
+                        ' id="'.$formid.'"'.
                         ' class="popupform">';
 
-    $output = '<select name="jump" onchange="'.$targetwindow.'.location=document.getElementById(\''.$formname.'\').jump.options[document.getElementById(\''.$formname.'\').jump.selectedIndex].value;">'."\n";
+    $output = '<div><select name="jump" onchange="'.$targetwindow.'.location=document.getElementById(\''.$formid.'\').jump.options[document.getElementById(\''.$form.'\').jump.selectedIndex].value;">'."\n";
 
     if ($nothing != '') {
         $output .= "   <option value=\"javascript:void(0)\">$nothing</option>\n";
@@ -1033,11 +1032,12 @@ function popup_form($common, $options, $formname, $selected='', $nothing='choose
 
     $output .= '</select>';
     $output .= '<input type="hidden" name="sesskey" value="'.sesskey().'" />';
-    $output .= '<div id="noscript'.$formname.'" style="display: inline;">';
+    $output .= '</div>';
+    $output .= '<div id="noscript'.$formid.'" style="display: inline;">';
     $output .= '<input type="submit" value="'.$go.'" /></div>';
     $output .= '<script type="text/javascript">'.
                "\n//<![CDATA[\n".
-               'document.getElementById("noscript'.$formname.'").style.display = "none";'.
+               'document.getElementById("noscript'.$formid.'").style.display = "none";'.
                "\n//]]>\n".'</script>';
     $output .= '</form>' . "\n";