Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'BootstrapDialog' is undefined #146

Open
CecleCW opened this issue Jun 17, 2022 · 3 comments
Open

'BootstrapDialog' is undefined #146

CecleCW opened this issue Jun 17, 2022 · 3 comments
Labels
bug Something isn't working help wanted Extra attention is needed javascript Pull requests that update Javascript code

Comments

@CecleCW
Copy link

CecleCW commented Jun 17, 2022

Hi, there
I'm applying this amazing project to my website, but still, all the BootstrapDialog's gone under IE11, and it keeps saying

SCRIPT5009: 'BootstrapDialog' is undefined
dialog.js (1, 581)

And here's my dialog.js

define(function (require, exports, module) {
    function showMessage(options) {
        if (typeof (options) !== 'object') return
        BootstrapDialog.show({
            title: options.title,
            message: options.message || (options.load ? messages.Loading.text : ''),
            closable: typeof (options.closable) === 'undefined' ? true : options.closable,
            closeByBackdrop: typeof (options.closeByBackdrop) === 'undefined' ? true : options.closeByBackdrop,
            closeByKeyboard: typeof (options.closeByKeyboard) === 'undefined' ? true : options.closeByKeyboard,
            type: options.type || BootstrapDialog.TYPE_INFO,
            buttons: getDialogButton(options.buttonNameList, options.callback),
            onshow: options.onshow,
            onshown: onshown,
            onhide: options.onhide,
            onhidden: options.onhidden
        })

        function onshown(dialog) {
            if (options.load) {
                dialog.getModalBody().load(options.load.url, options.load.data, function () {
                    if (typeof options.load.callback === 'function') {
                        options.load.callback(dialog)
                    }
                })
            }
            if (options.onshown) {
                options.onshown(dialog)
            }
            var inputs = dialog.$modal.find('input[type=text], input[type=password]')
            if (inputs.length > 0) {
                $(inputs[0]).focus().select()
            }
            if (options.callback) {
                dialog.$modal.keypress(function (event) {
                    if (event.keyCode == 13) {
                        event.cancelBubble = true
                        event.returnValue = false
                        var focusElements = $(":focus")
                        if (focusElements && focusElements.length > 0 && focusElements[0].tagName == 'DIV') {
                            dialog.$modal.off('keypress')  // trigger submit one time when focus on the dialog
                            options.callback({ name: 'submit' }, dialog)
                        } else {
                            options.callback({ name: 'submit' }, dialog)
                        }
                        return false
                    }
                })
            }
        }
    }
    exports.showMessage = showMessage
})

Anyone can help?

@coliff coliff added bug Something isn't working help wanted Extra attention is needed javascript Pull requests that update Javascript code labels Jun 17, 2022
@coliff
Copy link
Owner

coliff commented Jun 17, 2022

heya - not sure why you're experiencing an issue with the Modal. It is working in this simple example.
https://coliff.github.io/bootstrap-ie11/tests/#modal

I'm not a JavaScript expert though so can't help any further but I'll leave this issue open for now in case anyone else can offer help.

@coliff
Copy link
Owner

coliff commented Jun 17, 2022

@CecleCW - did you see the reply in #105 ? Maybe that might help?

@CecleCW
Copy link
Author

CecleCW commented Jun 20, 2022

@coliff sorry for the late reply, but #105 is not the same case. Moreover, actually in my website, there are 3 errors occurred, I'm not sure if they're related

SCRIPT1002: Syntax error
bootstrap.bundle.min.js (6, 263)

SCRIPT5007: Unable to get property 'Constructor' of undefined or null reference
bootstrap-dialog.min.js (1, 881)

SCRIPT5009: 'BootstrapDialog' is undefined
dialog.js (1, 581)

By the way, I'm using Bootstrap v5.1.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed javascript Pull requests that update Javascript code
Projects
None yet
Development

No branches or pull requests

2 participants