Dropdownlist onchange example is showing below. In dropdownlist first attribute is $name ,second attribute should be null, third attribute is $items array and fourth attribute is $options. In this example we are using a callAFunction() on onchange method.
Yii2 Html dropdownlist onchange
use yii\helpers\Html;
Html::beginForm()
Html::dropDownList(
'username',
'null',
['1'=>'abc', '2'=>'xyz'],
['onchange'=>'callAFunction()']);
Html::endForm()
//Javascript function
function callAFunction(){
alert('I am here');
}
Nice Blog , This is what I exactly Looking for , Keep sharing more blog .
ReplyDeleteYii Framework Development Company – Nintriva