1. Use XHTML-Compatible attributes for selected and checked form widgets
authoravel <avel@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Wed, 28 Apr 2004 16:05:25 +0000 (16:05 +0000)
committeravel <avel@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Wed, 28 Apr 2004 16:05:25 +0000 (16:05 +0000)
2. Use HTML <label> for radio buttons. This allows user to click the text
"Yes" or "No" instead of just the widget. This works in all popular browsers
and is more intuitive this way.

git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@7298 7612ce4b-ef26-0410-bec9-ea0150e637f0

functions/options.php

index c72aea4828cfea8611b022be6363f0cb7bcfa53f..80d925f0c6ebe6cb95215b451e52f5401b659bfa 100644 (file)
@@ -223,7 +223,7 @@ class SquirrelOption {
 
             /* If this value is the current value, select it. */
             if ($real_value == $this->value) {
-               $new_option .= ' selected';
+               $new_option .= ' selected=""';
             }
 
             /* Add the display value to our option string. */
@@ -318,22 +318,24 @@ class SquirrelOption {
     function createWidget_Boolean() {
         /* Do the whole current value thing. */
         if ($this->value != SMPREF_NO) {
-            $yes_chk = ' checked';
+            $yes_chk = ' checked=""';
             $no_chk = '';
         } else {
             $yes_chk = '';
-            $no_chk = ' checked';
+            $no_chk = ' checked=""';
         }
 
         /* Build the yes choice. */
-        $yes_option = '<input type="radio" name="new_' . $this->name
-                    . '" value="' . SMPREF_YES . "\"$yes_chk $this->script>&nbsp;"
-                    . _("Yes");
+        $yes_option = '<input type="radio" id="new_' . $this->name . '_yes" '
+                    . 'name="new_' . $this->name . '" value="' . SMPREF_YES . '"'
+                    . $yes_chk . ' ' . $this->script . '>&nbsp;'
+                    . '<label for="new_'.$this->name.'_yes">' . _("Yes") . '</label>';
 
         /* Build the no choice. */
-        $no_option = '<input type="radio" name="new_' . $this->name
-                   . '" value="' . SMPREF_NO . "\"$no_chk $this->script>&nbsp;"
-                   . _("No");
+        $no_option = '<input type="radio" id="new_' . $this->name . '_no" '
+                   . 'name="new_' . $this->name . '" value="' . SMPREF_NO . '"'
+                   . $no_chk . ' ' . $this->script . '>&nbsp;'
+                    . '<label for="new_'.$this->name.'_no">' . _("No") . '</label>';
 
         /* Build and return the combined "boolean widget". */
         $result = "$yes_option&nbsp;&nbsp;&nbsp;&nbsp;$no_option";