mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 05:58:34 +01:00
MDL-65217 core_form: use uniqie element id in filepicker
This commit is contained in:
parent
14cdf51189
commit
54e067dd47
@ -8,10 +8,10 @@ M.form_filepicker.callback = function(params) {
|
||||
html += '<div class="dndupload-progressbars"></div>';
|
||||
M.form_filepicker.Y.one('#file_info_'+params['client_id'] + ' .filepicker-filename').setContent(html);
|
||||
//When file is added then set status of global variable to true
|
||||
var elementname = M.core_filepicker.instances[params['client_id']].options.elementname;
|
||||
M.form_filepicker.instances[elementname].fileadded = true;
|
||||
var elementid = M.core_filepicker.instances[params['client_id']].options.elementid;
|
||||
M.form_filepicker.instances[elementid].fileadded = true;
|
||||
//generate event to indicate changes which will be used by disable if or validation code
|
||||
M.form_filepicker.Y.one('#id_'+elementname).simulate('change');
|
||||
M.form_filepicker.Y.one('#'+elementid).simulate('change');
|
||||
};
|
||||
|
||||
/**
|
||||
@ -22,8 +22,8 @@ M.form_filepicker.init = function(Y, options) {
|
||||
M.form_filepicker.Y = Y;
|
||||
|
||||
//For client side validation, initialize file status for this filepicker
|
||||
M.form_filepicker.instances[options.elementname] = {};
|
||||
M.form_filepicker.instances[options.elementname].fileadded = false;
|
||||
M.form_filepicker.instances[options.elementid] = {};
|
||||
M.form_filepicker.instances[options.elementid].fileadded = false;
|
||||
|
||||
//Set filepicker callback
|
||||
options.formcallback = M.form_filepicker.callback;
|
||||
|
@ -155,7 +155,7 @@ class MoodleQuickForm_filepicker extends HTML_QuickForm_input implements templat
|
||||
$args->maxbytes = $this->_options['maxbytes'];
|
||||
$args->context = $PAGE->context;
|
||||
$args->buttonname = $elname.'choose';
|
||||
$args->elementname = $elname;
|
||||
$args->elementid = $id;
|
||||
|
||||
$html = $this->_getTabs();
|
||||
$fp = new file_picker($args);
|
||||
|
Loading…
x
Reference in New Issue
Block a user