summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlezvous.ca>2008-06-26 14:27:05 -0400
committerEvan Prodromou <evan@controlezvous.ca>2008-06-26 14:27:05 -0400
commitf5caccc8276252edcffa7fb3dc778cba7bc50d0a (patch)
tree19d617397edaf33cd88becf2713b3f19acc24c4b /lib
parent1152a0f6803291db3d905aed47989bcccf9f9f72 (diff)
show checkbox as checked or not
darcs-hash:20080626182705-34904-893d72f480c330beb2d8f871da0d2cd9b902ffbf.gz
Diffstat (limited to 'lib')
-rw-r--r--lib/util.php8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/util.php b/lib/util.php
index a20f64c85..e3c00b31d 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -319,16 +319,18 @@ function common_input($id, $label, $value=NULL,$instructions=NULL) {
common_element_end('p');
}
-function common_checkbox($id, $label, $instructions=NULL, $value='true')
+function common_checkbox($id, $label, $checked=false, $instructions=NULL, $value='true')
{
common_element_start('p');
$attrs = array('name' => $id,
'type' => 'checkbox',
- 'id' => $id,
- 'value' => $value);
+ 'id' => $id);
if ($value) {
$attrs['value'] = htmlspecialchars($value);
}
+ if ($checked) {
+ $attrs['checked'] = 'checked';
+ }
common_element('input', $attrs);
# XXX: use a <label>
common_text(' ');