Hi all, i have a Select2 Kartik Widget and i want that when the user insert a string that don’t find anything in the select, i intercept that moment and i want that appears a button “INSERT NEW ARTICLE”
Can someone give me any help?
Thanks’1000
this is my widget:
echo Select2::widget([
'name' => 'artsel',
'data' => ArrayHelper::map(\app\models\Art::findBySql('SELECT DISTINCT descr as key, descr as value FROM Art ORDER BY key')->asArray()->all(), 'key', 'value'),
'options' => [
'placeholder' => 'Select Article ...',
],
'pluginEvents' => [
"change" => "function() {
$.post( \"".Yii::$app->urlManager->createUrl('stock/artcheck')."\", {artsel:$(this).val()}, function( data ) {
$( \".view-art\" ).html( data );
$( \".view-art-spec\" ).empty();
});
$(\"#stock-qta\").focus();
}",
],
]);