dropDownList yii2中的onchange函数 [英] onchange function in dropDownList yii2

查看:94
本文介绍了dropDownList yii2中的onchange函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在onchange事件dopDownList中,我有一个函数(getArticleByFamille),如下所示:

I have a function (getArticleByFamille) in event onchange dopDownList like this:

<?= $form->field($modelFamille, 'idFamille')->dropDownList(
    ArrayHelper::map(Famille::find()->all(), 'idFamille', 'libelle'),
    [
        'prompt' => 'Sélectionner la Categorie',
        'class' => 'chosen-select mb-15',
        'onchange' => 'getArticleByFamille(this.value,"vente/devis","' . Yii::$app->getUrlManager()->getBaseUrl() . '","ArticleByFamille")'
    ]
)->label(false); ?>

但是当我调用此函数时,它不起作用,并且当我检查我有以下代码时:

but When I call this function, it not working and when I inspect I have this code:

onchange="getArticleByFamille(this.value,&quot;vente/devis&quot;,&quot;/performancia/web&quot;,&quot;ArticleByFamille&quot;)"

报价已更改

推荐答案

这是因为发生编码(默认情况下启用).

It is because occurs encoding (enabled by default).

尝试一下(未测试):

[
    'prompt'   => 'Sélectionner la Categorie',
    'class'    => 'chosen-select mb-15',
    'onchange' => new \yii\web\JsExpression( 'getArticleByFamille(this.value,"vente/devis","' . Yii::$app->getUrlManager()->getBaseUrl() . '","ArticleByFamille")' )
]

这篇关于dropDownList yii2中的onchange函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆