jqueryasp.netdotnetnukedotnetnuke-moduledotnetnuke-9

DotNetNuke 9 dnnConfirm dialog error


It seems that since DotNetNuke 9 the build-in confirm dalog dnnConfirm does not work anymore like it did before or has been removed. The error is Uncaught TypeError: $(...).dnnConfirm is not a function

I uses it like this

<script type="text/javascript">
    $('.DeleteButton').each(function (index, item) {
        $(this).dnnConfirm({
            text: 'Delete this item?',
                yesText: 'Yes',
                noText: 'No',
                title: 'Delete Dialog',
                width: 400,
                isButton: false
            });
        });
</script>

I looked it up in the documentation, but could not find anything.

Does anyone have a fix/workaround/solution?

UPDATE

I just found out the function is present when you log in as a SuperUser but not as a visitor or normal user who is logged in. This would indicate that some JS files are only loaded when SuperUser whereas they were always present in previous versions.


Solution

  • The problem has been identified and a solution has been found. The file that was missing on the client side was dnn.jquery.js. In older versions of DNN (< 7.3) it was added by calling DotNetNuke.Framework.jQuery.RequestDnnPluginsRegistration(); in code behind.

    But since version 7.3 it has been replaced with JavaScript.RequestRegistration

    using DotNetNuke.Framework.JavaScriptLibraries;
    
    protected void Page_Load(object sender, EventArgs e)
    {
        JavaScript.RequestRegistration(CommonJs.DnnPlugins);
    }