php - Kartik/Krajee Select2 not disabled -


setting select to 'disabled' not disable element. user can still click on text of select2 , options box opens up. here disabled control opened clicking on text , not down-arrow button.

disabled control:

here code:

<?= $form->field($model, 'billing_currency_id')->widget(select2::classname(), [ 'data' => billingcurrency::listidcodes('','',true), 'disabled' => true, 'options' => ['disabled' => true,], 'pluginoptions'=>[     'allowclear'=>false,     'dropdownautowidth'=>true,     'disabled' => true, ], ]); ?> 

clicking on down-arrow button keeps control closed, clicking on text area of control opens options box.

update found own mistake - see answer below.

i made mistake - have custom js code on site opens select2 when gets focus. code causing reported problem.
custom code created overcome limitation of select2 whereby not automatically open when user tabs control. i've corrected code. when select2 gets focus either tab or click, control opens popup unless disabled. (previously didn't have check disabled attribute.)

$(document).on('focus', '.select2', function() {     var elselect = $(this).siblings('select');     if (elselect.is('[disabled]')==false) {         elselect.select2('open');     } }); 

Comments

Popular posts from this blog

android - Why am I getting the message 'Youractivity.java is not an activity subclass or alias' -

Making Empty C++ Project: General exception (Exception from HRESULT:0x80131500) Visual Studio Community 2015 -

How to fix java warning for "The value of the local variable is not used " -