2amigos / yii2-selectize-widget

Selectize From Brian Reavis Yii2 Widget
Other
73 stars 41 forks source link

for updating tagnames is not selected in the SelectizeTextInput..please help me to solve this #23

Closed vc7deo closed 7 years ago

vc7deo commented 8 years ago

taggable

and manually put * 'value' => 'munnar,kerala',* for checking if its selected in the selectizetextinput

     <?= $form->field($model, 'tagNames')->widget(SelectizeTextInput::className(), [
    'loadUrl' => ['tag/list'],
    'options' => ['class' => 'form-control'],
        'value' => 'munnar,kerala',
    'clientOptions' => [
        'plugins' => ['remove_button'],
        'valueField' => 'name',
        'labelField' => 'name',
        'searchField' => ['name'],
        'create' => true,
    ],
])->hint('Use commas to separate tags') ?>
tonydspaniard commented 8 years ago

@vc7deo I do not have those issues at all. Have you make sure 'tagNames' is set in rules as 'safe' ? is it set? You should not set the 'value' but ensure the 'tagNames' is actually filled with imploded values when you display the form.

On another note, i see that you have not put the 'delimiter'. Do you mind updating your code with it?

<?= $form->field($model, 'zip')->widget(
    SelectizeTextInput::className(),
    [
        'options' => ['class' => 'form-control'],
        'clientOptions' =>
            [
                'plugins' => ['remove_button'],
                'create' => true,
                'delimiter' => ',',
                'persist' => false,
                'createOnBlur' => true
            ]
    ]
)->hint('Use commas to delimit zip codes') ?>