onReady() error [SOLVED]

Hi Genry,
Thanks for the reply.

First, I tried to put a console.log message as you specified. It printed when I clicked the SUBMIT button (button 6). So this means that what is inside that onReady should execute when I click the button right?

Secondly, to explain what I am trying to achieve - I basically have a couple of sections on the page where you can click or unclick checkboxes, and when you do that you update an array with specific string values. The function is:

function update_checkbox(checkboxID, string, ID) {
 if ($w(checkboxID).checked) {
        selections[ID] = string;
        console.log(selections);
    } else {
        selections[ID] = '';
        console.log(selections);
    }
}

And an example call for that function when a checkbox is clicked is:

export function checkbox1_change(event, $w) {
    update_checkbox('#checkbox1', 'Autocad', 1);
}

Sadly, the console.log messages in the function don’t print out when I click checkboxes in the preview of the page. So something is preventing this function from running.

I have in my collection fields called “strategies” and “digital tools” with Key names “strategies_pdf” and “digital tools” respectively. When I hit SUBMIT, two new fields get saved called “[strategies]” and "[digital tools], and I can “add them to the schema” of the collection but when I try to do that they already exist (obviously).
They contain a string “undefinedundefinedundefinedundefine…” instead of strings from the checkboxes.

So I’m having a hard time understanding where the bug is that makes all of this not work.