Forum Replies Created

Viewing 16 replies (of 16 total)
  • I also ran into a problem with Checkboxes, but mine was a problem with the back end, on a post Edit page…

    I had a checkbox, and if i check it ON (value checkbox_on), and hit Update, the post meta gets saved with that field and value=”checkbox_on” aok. However, when I go back to edit that page again, the Checkbox itself was not showing up as CHECKED.

    I was able to tweak a couple of lines in the “function field_type_render” of the more-fields-settings-object.php file, and fixed this issue. The things I changed were :

    Line 363, changed from

    $value = (strstr($value_raw, '*') && ($html_selected)) ? substr($value_raw, 1) : $value_raw;

    to

    $value = (strpos($value_raw, '*')!==false && strlen($value_raw)>1 && ($html_selected)) ? substr($value_raw, 1) : $value_raw;

    Line 381-382, changed from

    else $html = str_replace('%selected%', '', $html);
    if ($value_stored == 'checkbox_on') $html = str_replace('%selected%', $html_selected, $html);

    to

    else if ($value_stored == 'checkbox_on') $html = str_replace('%selected%', $html_selected, $html);
    else $html = str_replace('%selected%', '', $html);

    i am not 100% sure if this is the correct solution to the problem, but at least with this change, Checkboxes maintain their checked/unchecked value

Viewing 16 replies (of 16 total)