General developer forum

Adding autocomplete feature to Quiz edit form

 
Picture of v k
Adding autocomplete feature to Quiz edit form
 

Hi all,

My goal is simple:  to add autocomplete feature for my custom fields in 'mod/quiz/mod_form.php', so that when I type some text, the possible options are retrieved from a text file on the server

I'm pretty sure it must be simple as we see it often on websites, but I need some help here, since I basically code Moodle with PHP, almost no experience with AJAX/JS. (I know that sounds silly...)

From the documentation - https://docs.moodle.org/dev/lib/formslib.php_Form_Definition#autocomplete - we know there is a class 

MoodleQuickForm_autocomplete.
It is recommended to create a subclass of MoodleQuickForm_autocomplete when using $mform.

In 'mod/quiz/mod_form.php' we see:
 class mod_wscits_mod_form extends moodleform_mod{...}
How do I add MoodleQuickForm_autocomplete here, I just cannot understand. 
Or should I go totally another way to add autocomplete feature to some field(s) in  'mod/quiz/mod_form.php'?

Thanks for reading. Any help and especially sample of autocomplete feature for some custom field would be very grateful!

Thank all!
 
Average of ratings: -