]> git.mjollnir.org Git - moodle.git/commitdiff
Fixes MDL-8627, "HTML QuickForm displays (some?) disabled elements in a non-accessibl...
authornfreear <nfreear>
Wed, 12 Sep 2007 11:17:35 +0000 (11:17 +0000)
committernfreear <nfreear>
Wed, 12 Sep 2007 11:17:35 +0000 (11:17 +0000)
lib/form/checkbox.php

index 2f4442645b1c6e8c51dd5e93100781d6e99babf7..a2d9cbd9707b4c55c73b78c83c4bfa309988eaf4 100644 (file)
@@ -103,19 +103,22 @@ class MoodleQuickForm_checkbox extends HTML_QuickForm_checkbox{
     {
         return '<span>' . parent::toHtml() . '</span>';
     }
+
     /**
-     * Slightly different container template when frozen. Don't want to use a label tag
-     * with a for attribute in that case for the element label but instead use a div.
-     * Templates are defined in renderer constructor.
-     *
-     * @return string
+     * Returns the disabled field. Accessibility: the return "[ ]" from parent
+     * class is not acceptable for screenreader users, and we DO want a label.
+     * @return    string
      */
-    function getElementTemplateType(){
-        if ($this->_flagFrozen){
-            return 'static';
+    function getFrozenHtml()
+    {
+        //$this->_generateId();
+        $output = '<input type="checkbox" disabled="disabled" id="'.$this->getAttribute('id').'" ';
+        if ($this->getChecked()) {
+            $output .= 'checked="checked" />'.$this->_getPersistantData();
         } else {
-            return 'default';
+            $output .= '/>';
         }
-    }
+        return $output;
+    } //end func getFrozenHtml
 }
 ?>
\ No newline at end of file