Yii 1.X バージョンでは、クラスのafterValidate
内部clientOptions
プロパティを使用できますCActiveForm
が、Yii2 で同じものを実装する正しい方法を教えてください。
6816 次
1 に答える
2
私はちょうどこれらの変化を見ました。なぜコアチームの開発者がそうすることに決めたのか、非常に驚いています。
beforeValidate
、afterValidate
、
beforeValidateAttribute
、
afterValidateAttribute
、
beforeSubmit
、
ajaxBeforeSend
、
ajaxComplete
関数がフロントエンド側に移動されました。それらはjQuery
trigger
関数によってトリガーされます。次のように、必要なイベントをキャッチできます。
$("#FORM-ID").on("afterValidate", function (event, messages) {
// Now you can work with messages by accessing messages variable
var attributes = $(this).data().attributes; // to get the list of attributes that has been passed in attributes property
var settings = $(this).data().settings; // to get the settings
});
于 2015-06-24T12:29:51.867 に答える