Hi All,
How to disable autocomplete in moodle form upon checkbox?
$users = $DB->get_records('<table_name>');
$userssarr = array();
foreach ($users as $user) {
$userssarr[$tenant->id] = $user->id;
}
$options = array('multiple' => true, 'noselectionstring' => get_string('string', '<pluginname>'));
$mform->addElement('checkbox', 'mycontrol', get_string('string2', '<pluginname>'));
$mform->addElement('autocomplete',
'userlist',
get_string('userlist', '<pluginname>'), $userssarr, $options);
$mform->addRule('userlist', get_string('missing', '<pluginname>'), 'required', null, 'server');
$mform->disabledIf('userlist', 'mycontrol', 'neq', 0);
But this checkbox will not control the auto complete dropdown. Can anyone help me to solve it?
Thanks and regards,
Sandipa