Commit 9060fbbd authored by Aaron Wells's avatar Aaron Wells Committed by Kristina Hoeppner
Browse files

Fixing problem with select2 display of initial selection

Bug1519976

behatnotneeded

Change-Id: I4c582239405cb7a4d2b96144e0dd4aa63ced28c1
parent 03de62f8
......@@ -194,9 +194,18 @@ $form = pieform(array(
'ajaxurl' => get_config('wwwroot') . 'module/multirecipientnotification/sendmessage.json.php',
'initfunction' => 'translate_ids_to_names',
'multiple' => true,
'extraparams' => array('escapeMarkup' => 'function (markup) { return markup; }', // let our custom formatter work
'templateSelection' => 'function (data) { console.log(data); return data.name; }'
),
'extraparams' => array(
'escapeMarkup' => 'function (markup) { return markup; }', // let our custom formatter work
'templateSelection' =>
'function (data) {
if (typeof data.name !== "undefined") {
return data.name;
}
else {
return data.text;
}
}',
),
'ajaxextraparams' => array(),
'rules' => array('required' => true),
),
......
<select class="js-data-ajax" multiple="multiple" id="{{$id}}" name="{{$name}}[]" {{if $describedby}}aria-describedby="{{$describedby}}"{{/if}}">
<select class="js-data-ajax" multiple="multiple" id="{{$id}}" name="{{$name}}[]" {{if $describedby}}aria-describedby="{{$describedby}}"{{/if}}>
{{if $initvalues}}
{{foreach from=$initvalues item=value}}
<option selected value="{{$value->id}}">{{$value->text}}</option>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment