liquid.ideas
New Member
Hi All,
Id really appreciate any advice, banging my head a bit here!
So what I have is a group with two checkbox elements in, multiple checkboxes. what I want it to do is count how many checkboxes are checked. I have managed this with all ajax cal and calc on load set to yes. If I do not use the ajax calc nothing happens, so here is the kicker it does not update the database although it displays right. If I take off ajax and calc on load it doesnt display right it displays "2". so here is a little more insight:
Thats the code I use, however the database score row (the calc element) always stays at "2" therefore I cant use that total to make other totals around the form!
I hope I have explained this well enough, any help would be much appreciated.
Id really appreciate any advice, banging my head a bit here!
So what I have is a group with two checkbox elements in, multiple checkboxes. what I want it to do is count how many checkboxes are checked. I have managed this with all ajax cal and calc on load set to yes. If I do not use the ajax calc nothing happens, so here is the kicker it does not update the database although it displays right. If I take off ajax and calc on load it doesnt display right it displays "2". so here is a little more insight:
PHP:
$chbox = $data['drakensberg_gardens_9_repeat___gr_field1_raw'];
$chbox_count = 0;
if (!empty($chbox)) {
if (!is_array($chbox)) {
$chbox = json_decode($chbox, true);
}
$chbox_count1 = count($chbox);
}
$chbox = $data['drakensberg_gardens_9_repeat___gr_field2_raw'];
$chbox_count = 0;
if (!empty($chbox)) {
if (!is_array($chbox)) {
$chbox = json_decode($chbox, true);
}
$chbox_count2 = count($chbox);
}
return $chbox_count1 + $chbox_count2;
I hope I have explained this well enough, any help would be much appreciated.