Checkbox value

we webcrea 23 Jul, 2018
hi,
​
Where indicate value should be 1 when checkbox is cheked ?
Knowing that value come from the DB and her current value is {var:read_data11.user.politiquement_expose}
Ghost activated with value 0
​
thanks
Gr GreyHead 23 Jul, 2018
HI Chistophe,
​
You set the default value in the Value box of the Checkbox element.
​
Bob
we webcrea 23 Jul, 2018
Hello Bob,
​
And where i put the value from db please?
{var:read_data11.user.politiquement_expose}
​
Regards
he healyhatman 24 Jul, 2018
OK so in the value box of the checkbox put 1

In your event BEFORE you display the section, do a custom code with
​
{data.set:checkbox_name$(var:read_data11.user.politiquement_expose)}
we webcrea 24 Jul, 2018
Thanks Healy,
I understand but there is not a more easy possibility to informe the value.
@Max : this is an issue to solve
I have many checkbox to manage.
Thanks for all
he healyhatman 24 Jul, 2018
If you want the VALUE to be set by a database read, put it in the value box.
​
If you want to programmatically set whether or not the checkbox is checked, you'll just have to do what I said.
we webcrea 26 Jul, 2018
Hello,
​
Sorry but if i post this, that's because this solution doesn't work!
Value is the value takes the input if checked not the real value.
​
regards
he healyhatman 27 Jul, 2018
After checking more, there's a "checked status provider" field under Advanced.
we webcrea 27 Jul, 2018
Yes I saw and i tried several code provider but nothing plays well
he healyhatman 27 Jul, 2018
Your provider will probably need to return either true/false or 1/0 to work.
we webcrea 27 Jul, 2018
{var:read_data11.user.politiquement_expose}
​
return 0 or 1
he healyhatman 27 Jul, 2018
Actually no just tested it out. As long as your provider isn't returning 0, any value should check the box.
​
So put in (type it out don't copy paste)
{var:read_data11.user.politiquement_expose}
if that's what you want to use of course.
​
​
Just make sure you use debugged to check what value politiquement_expose is actually returning.
he healyhatman 27 Jul, 2018
OK so if it returns 0 or 1, what's the problem? When it returns 1 is it NOT checking the box? And you've checked the debug output to make sure of the value?
we webcrea 27 Jul, 2018
yes
When it returns 1 is it NOT checking the box
we webcrea 13 Sep, 2018
In final,
​
To save and use data from checkbox you have to :
​
In General
- field_name
- value : 1
​
In Advanced
- Activate ghost
- Value on 1
- Checked status provider : {var:read_data11.user.field_name}
- Data value : {var:read_data11.user.field_name}
This topic is locked and no more replies can be posted.