Console-msg: “Parsley's pubsub module is deprecated; use the corresponding jQuery event method instead”

怎甘沉沦 提交于 2019-12-12 03:33:42

问题


Trying to display error-msgs in a Bootstrap-Popup, I found a solution from TheDude and have adjusted the event-names for ps2.1:

$.listen('field:error', function (fieldInstance) {

    arrErrorMsg = ParsleyUI.getErrorsMessages(fieldInstance);
    errorMsg = arrErrorMsg.join(';');

    fieldInstance.$element
        .popover('destroy')
        .popover({
            container: 'body',
            placement: 'right',
            content: errorMsg
        })
        .popover('show');

});

$.listen('field:success', function (fieldInstance) {
    fieldInstance.$element.popover('destroy');
});

This works wonderfully, but I'm getting a msg in the JS-Console: "Parsley's pubsub module is deprecated; use the corresponding jQuery event method instead". There are very few hits for that msg in Google, and I'm afraid I'm not (yet) sufficiently versed with Parsley to understand and fix this problem - would appreciate some help to make my code future-proof :-)


回答1:


Sorry, I just was too impatient and started looking and it was easier than expected: the $.listen needs to be changed into window.Parsley.on. That's it! :-)



来源:https://stackoverflow.com/questions/31596353/console-msg-parsleys-pubsub-module-is-deprecated-use-the-corresponding-jquer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!