Unexpected behaviour from advanced checkboxes after update

Unexpected behaviour from advanced checkboxes after update

per Matías Olea -
Nombre de respostes: 2

I'm working on a module plugin. On its main form, there are several advanced checkboxes that, after updating to Moodle 4.1 from 3.9, no longer return any value when left in their initial state.

Only the checkboxes that are initially checked don't return anything; the ones initially unchecked work just fine.

If anyone has encountered a similar issue or has any insights on how to resolve this problem with the checkboxes not returning values in Moodle 4.1, I would greatly appreciate your input!

Mitjana de qualificacions: -
En resposta a Matías Olea

Re: Unexpected behaviour from advanced checkboxes after update

per Dominique Palumbo -
Imatge de Plugin developers
Hi,

Did you use the optional 6th parameters 'array(0, 1)' ?
https://docs.moodle.org/dev/lib/formslib.php_Form_Definition#advcheckbox

Dominique.
En resposta a Dominique Palumbo

Re: Unexpected behaviour from advanced checkboxes after update

per Matías Olea -
Hi! Thank you for your response.

Yes I used that parameter, my implementation is the following:

$mform->createElement('advcheckbox', "{$student->id}_{$state->isflipped}_{$enrol}", null,
"$student->lastname, $student->firstname",
array('group' => $enrolgroup, "$enrol"=>""), $state->state);

with $state->state being an array like you suggested.

I don't know if it's relevant but im also using a checkbox controller.