Hello everyone,
I'm trying to create a handle to autocomplete element in a form https://docs.moodle.org/dev/lib/formslib.php_Form_Definition#autocomplete
class my_form extends moodleform{
function definition(){
$mform = $this->_form;
$user = array(...);
$mform->addElement('autocomplete', 'hide_body_id', get_string('searcharea', 'search'), $user, $options);
}
}
-------------------------------
my.php
include_once 'my_form.php';
...
$mform = new admin_form();
$mform->display();
$PAGE->requires->js_call_amd('block_myblock/hide', 'init');
------------------------------------
my_block/amd/src/hide.js
define(['jquery'], function($) {
var t = {
init : function() {
$('#fitem_id_hide_body_id input[id^=form_autocomplete_input]').on('input', function(){
$(body).hide(); <----- Never execute
)};
)};
return t;
}
I has been noted that "autocomplete" element load in same time that amd module load...
Then I need a way to wait to autcomplete load, then amd module can detect it.
Thanks in advance.