WebsiteBaker Community Forum
General Community => Global WebsiteBaker 2.8.x discussion => Topic started by: Xagone on October 12, 2011, 03:56:38 PM
-
simple bug on form module
if you do 2 or more "checkbox" or "radio" with the same choices, the labels will not work properly and you will choose only in the first choices
ex:
choices one:
[] choice1
[] choice2
[] choice3
choices two:
[] choice1
[] choice2
[] choice3
when you click on the choices of "choices two" it'l select the firsts one (because of the labels names and for)
i got a version 2.8.1 wb mod to work, maybe the last version could have this mini mod too in the same way
in the fonction make_checkbox in view.php
function make_checkbox(&$n, $idx, $params) {
$field_id = $params[0][0];
$seperator = $params[0][1];
$label_id = 'wb_'.str_replace(" ", "_", $n);
if(in_array($n, $params[1])) {
$n = '<input class="field_checkbox" type="checkbox" id="'.$label_id.'" name="field'.$field_id.'['.$idx.']" value="'.$n.'" checked="checked" />'.'<label for="'.$label_id.'" class="checkbox_label">'.$n.'</lable>'.$seperator;
} else {
$n = '<input class="field_checkbox" type="checkbox" id="'.$label_id.'" name="field'.$field_id.'['.$idx.']" value="'.$n.'" />'.'<label for="'.$label_id.'" class="checkbox_label">'.$n.'</label>'.$seperator;
}
}
i've changed
$label_id = 'wb_'.str_replace(" ", "_", $n);
to
$label_id = 'wb_'.$field_id.'_'.str_replace(" ", "_", $n);
and i think that for 2.8.2 the line is
$label_id = 'wb_'.preg_replace('/[^a-z0-1]/i', '_', $n);
and should be change as
$label_id = 'wb_''.$field_id.'_'.preg_replace('/[^a-z0-1]/i', '_', $n);
and make_radio have the same problem.