Closed albertborsos closed 7 years ago
This one is OK, but i need to write the surrounding template, and the validation does not work.
<?= \kartik\widgets\Select2::widget([
'id' => Html::getInputId($model, '[' . $id . ']quick_replies'),
'name' => Html::getInputName($model, '[' . $id . ']quick_replies'),
'options' => [
'multiple' => true,
],
'value' => $model->getQuickRepliesToSelect2(),
'data' => [],
'pluginOptions' => [
'tags' => true,
'allowClear' => true,
'minimumInputLength' => 1,
'tokenSeparators' => [',', ' '],
],
]) ?>
Not completely clear with how you are rendering the HTML markup. It seems you may have duplicate identifiers (HTML id
attribute) for select2 widget input on the same page which would cause the plugin to break and you need to keep it unique.
For example tagging similar to your code works on the demo page here.
No, there is only one id.
On the demo page there is an example with static widget. But i have issue when i use with ActiveForm
instance like $form->field($model, 'attribute')->widget(Select2::className(), $config)
I will make a live example later.
The first example on the demo page for tags usage is a widget with model and active form.
OK, I found it. There was a trim filter in the model's rule method. After I removed it, then the widget starts working as expected.
Prerequisites
master
branch of yii2-widget-select2.Steps to reproduce the issue
Expected behavior and actual behavior
When I follow those steps, I see that after the second item the first 2 disappear:
I was expecting it does not disappear.
Environment
Browsers
Operating System
Libraries
Isolating the problem