titlewidth col-form-label'";
- $res .= " for='". $this->formName."_";
- $res .= htmlspecialchars ($this->name, ENT_QUOTES);
- if (is_array ($this->titles) && count ($this->titles) > 1)
- $res .= "_0";
- $res .= "'";
+ if (is_array ($this->titles) && count ($this->titles) == 1 &&
+ reset ($this->titles) === "")
+ {
+ // If more than one title is set, the main label is unusable, so
+ // do not link it to the checkbox
+ // If there is no label on the checkbox, this label must be set
+ $res .= " for='". $this->formName."_";
+ $res .= htmlspecialchars ($this->name, ENT_QUOTES);
+ $res .= "'";
+ }
if (isset ($this->hidden) && $this->hidden !== FALSE)
$res .= " style='display:none'";
$res .= ">";
@@ -1527,8 +1547,6 @@ class formfield
$res .= "\n";
}
$res .= "
\n";
- if (! is_array ($this->titles) || count ($this->titles) === 0)
- $this->titles = array ("");
foreach ($this->titles as $key=>$val)
{
$res .= "
\n";
@@ -1602,9 +1620,9 @@ class formfield
}
$res .= "/>\n";
$res .= "