checkbox value in database

Mikmac

New Member
Hi, Still in F1.0.6. I have a checkbox element with one box with value 'present'.
Now regardless whether it is checked or not it registers 'present' in the database. (I believe that's php behaviour?!).

In the database I actually want to see whether it is checked or not.
How to deal with this? I tried:

1. in the element set "Data to record if no checkboxes ticked" to another value eg 'not present'
but that did not return that result to the database (bug?) and I guess it would not work when we would have more than 1 item in the element.

2. on form submit a script that returns a value on the condition 'checked or not'
i tried something like (the id of the checkbox is jos_fabrik_formdata_13___ss01p):
Code:
if(isset(jos_fabrik_formdata_13___ss01p_0)){
$sql="UPDATE jos_fabrik_formdata_13 SET ss01p='present' WHERE bwof_join='x'";
}else{
$sql="UPDATE jos_fabrik_formdata_13 SET ss01p='not present' WHERE bwof_join='x'";
}
$database->setQuery($sql);
$database->query()
returns a parse error
any useful comments?
 
Does your checkbox actually render correctly on the form, i.e. if it should be not checked, it isn't checked, and if it should be checked, it is checked?

I just can't duplicate this one. Here's four consecutive records from my main 1.0.6 test table (copied directly from Navicat), showing the value of a multi select checkbox. The first one was with no selection, after I just set "Data to record if no checkbox selected" to "nuthin". The second one is with two boxes selected. The third one is with no checkboxes selected (before I set the "data to record"), the fourth one is with one value selected.

Code:
nuthin
foo1//..*..//foo2

foo1
-- hugh
 
hmmmm, strange.

I noticed the following:
* form looks like it renders normally yes. It 'remembers' the selection (checked or unchecked) when you return to the form.
* if I look in phpMyAdmin the data are recorded correctly! Eg when checked: 'present' and when unchecked ' ' or 'not present' if I have filled that in at 'Data recorded if nothing ticked'.
* The correct data is not returned into the Fabrik table.
these are my settings:
element type: checkbox
data to record if no checkboxes ticked: not present
element before label: yes
number options per row: 1
sub elements:
value: present label: present
selected as default is not checked
* fabrik just records 'present' in the fabrik table whether checked or not.

I really haven't got a clue why.
 
hey Hugh,
Any chance or attempt having this fixed?
[ticket #217]
I have still got this thing implemented in a form, but can't use the functionality of it until your golden eye has looked at it.
Thanks
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top