Hi all. I’m currently looking for a way to successfully add an event handler for a drop down menu with yii2. The closest solution to this so far is http://kalkanotel.com/yii2-how-to-add-onchange-event-in-activeform-i59116.htm.
In the ActiveForm I have the following:
<?php $form = ActiveForm::begin([
'options' => ['enctype' =>
'multipart/form-data'],
'layout' => 'horizontal']); ?>
<?= $form->field($model, 'brand_id', [
'horizontalCssClasses' => [
'wrapper' => 'col-sm-3',
'label' => 'hidden',
]])->dropDownList($dataBrandName, array ('onchange'=>'getData()',
'class' =>'form-control',
'prompt'=>' ----- Select by Brand -----',
'selected'=>'selected',
) ) ?>
This produces a drop down without use of javascript; however when a brand is selected there is no result. If anyone can point me in the direction of a working example or explain what I need to do to submit this via onchange or onclick I would greatly appreciate it.
Thanks