Hi everybody!
I want to use Ajax in Quiz Activity (moodle 2.2) for selecting more details something like this picture:
I added new elements in /quiz/mod_form.php and I use this code to generate Course Category:
$ coursecategory = myfunc_array_merge($default_ coursecategory, $ coursecategory);
$mform->addElement('select', 'degree', get_string(‘coursecategory’), $ coursecategory, 'onchange=myfunc_load_course(\'id_coursecategory\',\'id_course\')');
$mform->addRule(' coursecategory ', get_string('missingcoursecategory '), 'required', null, 'server');
$mform->setDefault(' coursecategory ', $default_ coursecategory ['0']);
This part is worked with the Ajax functions, but:
1. In my way I should load and generate all courses during quiz page loading for 2nd combo-box, Otherwise the loaded course items in 2nd combo-box will not be recorded in database (the $mfrom object cannot save them). I do not know why and what should I do?
2. by this way I can load the items in combo-box but How can I load question categories of the selected course as a group of checkboxs as like as picture (No.#3)?