]> git.mjollnir.org Git - moodle.git/commitdiff
now wrapping a group element in a fieldset tag, brought id tag on checkboxes and...
authorjamiesensei <jamiesensei>
Thu, 28 Sep 2006 04:18:35 +0000 (04:18 +0000)
committerjamiesensei <jamiesensei>
Thu, 28 Sep 2006 04:18:35 +0000 (04:18 +0000)
lib/form/checkbox.php
lib/form/group.php
lib/form/radio.php

index 9a7f6f9ee05d386621187aa44f605870d3b1ea45..0817ca9b26b11a16f5413a72fdc7d25a901e810e 100644 (file)
@@ -41,5 +41,23 @@ class moodleform_checkbox extends HTML_QuickForm_checkbox{
     function getHelpButton(){
         return $this->_helpbutton;
     }
+   /**
+    * Automatically generates and assigns an 'id' attribute for the element.
+    * 
+    * Currently used to ensure that labels work on radio buttons and
+    * checkboxes. Per idea of Alexander Radivanovich.
+    * Overriden in moodleforms to remove qf_ prefix.
+    *
+    * @access private
+    * @return void 
+    */
+    function _generateId()
+    {
+        static $idx = 1;
+
+        if (!$this->getAttribute('id')) {
+            $this->updateAttributes(array('id' => substr(md5(microtime() . $idx++), 0, 6)));
+        }
+    } // end func _generateId
 }
 ?>
\ No newline at end of file
index c0fa44ce324a5edf3611e5fe66cd4fab590344c6..f4fcc6e614bfcbf1de3d1b3aae6f6ec7db62fb67 100644 (file)
@@ -17,7 +17,7 @@ class moodleform_group extends HTML_QuickForm_group{
      * @var string
      */
     var $_helpbutton='';
-    var $_elementTemplateType='default';
+    var $_elementTemplateType='fieldset';
     //would cause problems with client side validation so will leave for now
     //var $_elementTemplateType='fieldset';
     /**
index d9a57dae9b578aebedfa5cedfea702e840fc00b1..f87638e8009d9b6d74e2bbad4ffc5cc1bcbceca5 100644 (file)
@@ -41,5 +41,23 @@ class moodleform_radio extends HTML_QuickForm_radio{
     function getHelpButton(){
         return $this->_helpbutton;
     }
+   /**
+    * Automatically generates and assigns an 'id' attribute for the element.
+    * 
+    * Currently used to ensure that labels work on radio buttons and
+    * checkboxes. Per idea of Alexander Radivanovich.
+    * Overriden in moodleforms to remove qf_ prefix.
+    *
+    * @access private
+    * @return void 
+    */
+    function _generateId()
+    {
+        static $idx = 1;
+
+        if (!$this->getAttribute('id')) {
+            $this->updateAttributes(array('id' => substr(md5(microtime() . $idx++), 0, 6)));
+        }
+    } // end func _generateId
 }
 ?>
\ No newline at end of file