Afternoon,
i have the below.
What i would like to do is after selection from drop down display some data from a related table.
View:
<?php $form = ActiveForm::begin(); ?>
<?= $model->isNewRecord ?
$form->field($model, 'quote_id') ->textInput(['readonly' => true, 'value' => $id])
:
$form->field($model, 'quote_id') ->textInput()
?>
<?= $form->field($model, 'part_id')->widget(Select2::classname(), [
'name' => 'Partselect',
'data' => $items,
'options' => ['placeholder' => 'Select a item ...', 'attribute' => 'category','id'=>'id_select'],
'pluginOptions' => [
'allowClear' => true
],
'pluginEvents' => [
"change" => 'function(e) {
var part_id = $(this).val();
//alert(part_id);
$("#testVal").val(part_id);
}',
],
]); ?>
/// Field to show related Data
controller:
$modelp = Parts::findOne('part_id');
any ideas?