Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Modified checkboxes #186

Closed
wants to merge 1 commit into from

2 participants

@zackkatz

Added labels for checkboxes; added 0 or 1 values to checkboxes, instead of on/off.

@zackkatz zackkatz Modified checkboxes
Added `label`s for checkboxes; added `0` or `1` values to checkboxes, instead of on/off.
efe1fab
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 21, 2012
  1. @zackkatz

    Modified checkboxes

    zackkatz authored
    Added `label`s for checkboxes; added `0` or `1` values to checkboxes, instead of on/off.
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 2 deletions.
  1. +3 −2 init.php
View
5 init.php
@@ -272,8 +272,9 @@ function show() {
echo '<p class="cmb_metabox_description">', $field['desc'], '</p>';
break;
case 'checkbox':
- echo '<input type="checkbox" name="', $field['id'], '" id="', $field['id'], '"', $meta ? ' checked="checked"' : '', ' />';
- echo '<span class="cmb_metabox_description">', $field['desc'], '</span>';
+ echo '<input type="hidden" value="0" name="', $field['id'], '" />';
+ echo '<input type="checkbox" value="1" name="', $field['id'], '" id="', $field['id'], '"', $meta ? ' checked="checked"' : '', ' />';
+ echo '<label for="',$field['id'],'"><span class="cmb_metabox_description">', $field['desc'], '</span></label>';
break;
case 'multicheck':
echo '<ul>';
Something went wrong with that request. Please try again.