Drop down multiple selection box colapsed

I created a form that expand and colapses the multiple selection buttons based on specific selection buttons:

When the user logs the first time works well. Based on his choices of knowledge areas the choices open properlly:

My problem is that when the user enters a second time in the form. I am not able to expand based on the information in the database. Looks like the fields that i am using are taking to much to be loaded and because of that the code understands that all options are not checked. My code bellow:

$w.onReady( function () {
let servico = $w(“#checkbox1”).checked
if (servico) {
$w(“#group1”).expand();
}
else {
$w(“#group1”).collapse();
}
let Estrategia = $w(“#checkbox2”).checked
if (Estrategia) {
$w(“#group2”).expand();
}
else {
$w(“#group2”).collapse();
}
let Financeiro = $w(“#checkbox3”).checked
if (Financeiro) {
$w(“#group3”).expand();
}
else {
$w(“#group3”).collapse();
}
etc …

Can anybody help me with this issue???

Thanx!!!

How are you using the database? Are you using Datasets ? Do you have code for the selections?

You’ll need to provide more information for us to be able to help.

Hi Yisrael,

I am using datasets. I dont have any codes for selection. The form is created by the users and updated by the same user, so the database has these permissions. Besides that is just a form connected with a database.

Thank you