Why weren't tag IDs part of the parameters to these functions in the first place...
[squirrelmail.git] / functions / forms.php
index be4709d98ab3c80edd2d51b510e0e3207c4575e8..d1a96888e3fbb794d676b052a8d84510c5df55de 100644 (file)
  * Helper function to create form fields, not to be called directly,
  * only by other functions below.
  */
-function addInputField($type, $name = null, $value = null, $attributes = '') {
+function addInputField($type, $name = null, $value = null, $attributes = '', $id = null) {
     return '<input type="'.$type.'"'.
         ($name  !== null ? ' name="'.htmlspecialchars($name).'"'   : '').
+        ($id  !== null ? ' id="'.htmlspecialchars($id).'"'   
+            : ($name  !== null ? ' id="'.htmlspecialchars($name).'"'   : '')).
         ($value !== null ? ' value="'.htmlspecialchars($value).'"' : '').
         $attributes . " />\n";
 }
@@ -45,7 +47,7 @@ function addCheckBox($name, $checked = false, $value = null) {
  */
 function addRadioBox($name, $checked = false, $value = null) {
     return addInputField('radio', $name, $value,
-        ($checked ? ' checked="checked"' : ''));
+        ($checked ? ' checked="checked"' : ''), $name . $value);
 }
 
 /**
@@ -144,4 +146,4 @@ function addForm($action, $method = 'post', $name = '', $enctype = '', $charset
         $enctype . $name . $charset . ">\n";
 }
 
-?>
\ No newline at end of file
+?>