Buy Now
Sign in

Checkbox dynamic value from DB

M.Abletech , March 13 2018, 14:07
M
M.Abletech 67
March 13 2018, 14:07 #376075
Hi,
I need to dynamically load value from DB for checkbox field: if it is check or not. How can I do that in chronoform v6? I know how to in chronoform v5.
Should I fill the advance tab? http://prntscr.com/iqmcu7
What should I fill both "Checked status provider" and "Data value"?
Thanks!
admin 29
March 24 2018, 03:07 #376377
Hello,
Its the "Checked status provider" which should be used, use {var:read_data_name.model_name.field_name}
Or just use {var:read_data_name.model_name} in the "Data provider" under the "Display section".
Best regards
Max
If your main question got answered then please mark the answer using the button!
Did you try the new ChronoForms7 ? if yes then please send us your comments!!
pat01 300
July 12 2019, 12:45 #388170
Hi Max
Has this changed in CF 6.1?
I use
{var:read_data13.Data_EPUser.usergroups} 
in Checked Options values, but the checkboxes are not checked.
For example using
{var:read_data13.Data_EPUser.firstname}
works fine in a textfield.
It's just the checkboxes that are not selected after load data. The debugger shows:
[read_data13
  • => Array
    (
    [log] => Array
    (
    [0] => SELECT `Data_EPUser`.`id` AS `Data_EPUser.id`, `Data_EPUser`.`privacy` AS `Data_EPUser.privacy`, `Data_EPUser`.`secondname` AS `Data_EPUser.secondname`, `Data_EPUser`.`avatar` AS `Data_EPUser.avatar`, `Data_EPUser`.`params` AS `Data_EPUser.params`, `Data_EPUser`.`facebook_id` AS `Data_EPUser.facebook_id`, `Data_EPUser`.`twitter_id` AS `Data_EPUser.twitter_id`, `Data_EPUser`.`google_id` AS `Data_EPUser.google_id`, `Data_EPUser`.`linkedin_id` AS `Data_EPUser.linkedin_id`, `Data_EPUser`.`instagram_id` AS `Data_EPUser.instagram_id`, `Data_EPUser`.`lastname2` AS `Data_EPUser.lastname2`, `Data_EPUser`.`firstname` AS `Data_EPUser.firstname`, `Data_EPUser`.`lastname` AS `Data_EPUser.lastname`, `Data_EPUser`.`wohnort` AS `Data_EPUser.wohnort`, `Data_EPUser`.`email` AS `Data_EPUser.email`, `Data_EPUser`.`usergroups` AS `Data_EPUser.usergroups` FROM `chrono_jsn_users` AS `Data_EPUser` WHERE `Data_EPUser`.`id` = '612' LIMIT 100;
    )

    [var] => Array
    (
    [Data_EPUser] => Array
    (
    [id] => 612
    [privacy] =>

  • [secondname] =>
    [avatar] =>
    [params] =>
    [facebook_id] =>
    [twitter_id] =>
    [google_id] =>
    [linkedin_id] =>
    [instagram_id] =>
    [lastname2] =>
    [firstname] => Vorname 1
    [lastname] => Nachname 1
    [wohnort] => Wohnort 1
    [email] => mail1@aa.dd
    [usergroups] => ["10","11","12"]
    )

    )

    )

    )
    So data is there.
    Any idea why it's not working?
    Thanks a lot.
    Patrick
    admin 29
    July 13 2019, 05:15 #388183
     1
     Answer
    It's working here, IF that value is an ARRAY, but if the data is stored as JSON string in your table then you should use:
    {var.jsonde:read_data13.Data_EPUser.usergroups} 
    Best regards
    Max
    If your main question got answered then please mark the answer using the button!
    Did you try the new ChronoForms7 ? if yes then please send us your comments!!
    pat01 300
    July 15 2019, 08:47 #388219
    Works great, thanks a lot!