http://www.chronoengine.com/forums/posts/t104781/p374275/cc6-v6-06-dbsave-not-updating-all-fields?startat=0#p374275
As I understand it, if the value from the database (eg, 1) is the same as the checked value of the checkbox (1), the checkbox will be checked.
However, what if the checkbox is checked by default (1), and I need to retrieve (0) from the database to get it unchecked?
If the checkbox name and value matches the table field name and value then it will be checked in case you have use the "Form data provider" under the "Display section" action to populate all the form fields.
As I understand it, if the value from the database (eg, 1) is the same as the checked value of the checkbox (1), the checkbox will be checked.
However, what if the checkbox is checked by default (1), and I need to retrieve (0) from the database to get it unchecked?
I could retrieve the value 0 from database using {var:table.row.Model.checkbox}, but putting {var:table.row.Model.checkbox} into 'Data value' for the checkbox field does not uncheck the checbox it as it should.
Checkbox details:
Value = 1
Checked by default = yes
Enable ghost = yes
Ghost value = 0
Data value: {var:table.row.Model.checkbox}
Checkbox details:
Value = 1
Checked by default = yes
Enable ghost = yes
Ghost value = 0
Data value: {var:table.row.Model.checkbox}
You don't want the value you want "checked status provider". If you're using the checkbox in the Fields element, then under Extra Attributes put
{fn:checked_status_switch}Create a switch action called checked_status_switch, or a PHP action whatever, and return "checked" when you want it checked, don't return anything when you want it unchecked.
What is the "checked status provider" for, and what do we put in it?
"Checked status provider" provides the checked status - if the field is checked or not - programmatically. So for example put in {data:test} and if {data:test} is 1 when the form loads, the field will be checked.
This topic is locked and no more replies can be posted.