When you have multiple instances of the widget on the same page, some of the components have the same ID (if they are associated with the same model).
Specifically ModelName2side__sx and ModelName2side__dx will be the same on each instance.
The problem seems to be in the jquery.multiselect2side.js file.
var originalName = $(this).attr("name"); if (originalName.indexOf('[') != -1) originalName = originalName.substring(0, originalName.indexOf('[')); var nameDx = originalName + "ms2side__dx"; var nameSx = originalName + "ms2side__sx"; "<div class='ms2side__select'>" + ... "<select title='" + o.labelsx + "' name='" + nameSx + "' id='" + nameSx + "' size='" + size + "' multiple='multiple' ></select>" + ... "<div class='ms2side__select'>" + ... "<select title='" + o.labeldx + "' name='" + nameDx + "' id='" + nameDx + "' size='" + size + "' multiple='multiple' ></select>" +
Has anybody solved this issue?
Would it be safe to just add the attribute label to the name and id to make it unique? (at least in my scenario).
I am dynamically modifying the possible selection list with AJAX but the wrong widget is being changed.
$(document).ready(function(){ $.ajax({ 'type': 'POST', 'data': $('#ModelName_id').parents("form").serialize(), 'url': '<?php echo CController::createUrl('controller/action'); ?>', 'cache': false, 'dataType': 'json', 'success': function(data){ $('#ModelName2side__dx').html(data); }, 'error': function (xhr, ajaxOptions, thrownError){ alert(xhr.responseText); } }) })
Could there be another way?
Thanks for your help.