diff options
-rw-r--r-- | views/default/input/checkboxes.php | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/views/default/input/checkboxes.php b/views/default/input/checkboxes.php index 1a10b8a62..5039b5523 100644 --- a/views/default/input/checkboxes.php +++ b/views/default/input/checkboxes.php @@ -18,14 +18,26 @@ *
*/
- foreach($vars['options'] as $option) {
- //if (!in_array($option,$vars['value'])) { - if ($option != $vars['value']) {
- $selected = "";
- } else {
- $selected = "checked = \"checked\"";
+ foreach($vars['options'] as $label => $option) {
+ //if (!in_array($option,$vars['value'])) {
+ if (is_array($vars['value'])) {
+ if (!in_array($option,$vars['value'])) {
+ $selected = "";
+ } else {
+ $selected = "checked = \"checked\"";
+ }
+ } else { + if ($option != $vars['value']) {
+ $selected = "";
+ } else {
+ $selected = "checked = \"checked\"";
+ }
}
- echo "<label><input type=\"checkbox\" {$vars['js']} name=\"{$vars['internalname']}[]\" {$selected} value=\"".htmlentities($option)."\" {$selected} />{$option}</label><br />";
+ $labelint = (int) $label;
+ if ("{$label}" == "{$labelint}") {
+ $label = $option;
+ }
+ echo "<label><input type=\"checkbox\" {$vars['js']} name=\"{$vars['internalname']}[]\" {$selected} value=\"".htmlentities($option)."\" {$selected} />{$label}</label><br />";
}
?>
\ No newline at end of file |