Score:0

Form States not working when compressed javascript is enabled

cn flag
blu

I have visible states setup for a 2 fields that correctly work when javascript aggregation is disabled. When I turn JS aggregation on both fields are visible no matter what option I select on the triggering field.

The error I see in the console is:

jQuery.Deferred exception: undefined is not an object (evaluating 'drupalSettings.dialog.buttonClass = 'btn'') 
(anonymous function) — js_fsUR56avHuCdleLNsv7K8iPJi-p2GvAib4YZimyUwYM.js:2656
e — js_iZGsOOYcwKj6smZrna-ZUEcxHgdurhEAEKqi_VGeytE.js:1399
(anonymous function) — js_iZGsOOYcwKj6smZrna-ZUEcxHgdurhEAEKqi_VGeytE.js:1407
undefined

The exact line causing this is:

 // Create the "modal" plugin bridge.
        Bootstrap.Modal.Bridge = function() {
            var Modal = this;

however I didn't write that line and can't seem to find it.

EDIT: These are the errors I get with JS aggregation disabled:

[Error] TypeError: undefined is not an object (evaluating 'Bootstrap.Modal')
    (anonymous function) (modal.jquery.ui.bridge.js:73)
    (anonymous function) (drupal.bootstrap.js:239)
    (anonymous function) (modal.jquery.ui.bridge.js:17)
    Global Code (modal.jquery.ui.bridge.js:585)
[Error] TypeError: undefined is not an object (evaluating '$.fn.tooltip.Constructor.DEFAULTS')
    (anonymous function) (drupal.js:14)

I'm not using any custom javascript on this page just relying purely on Drupals Form API and '#states'.

EDIT 2: Turning off "Enable Bootstrap Modals" in the themes appearance settings menu allows the states to continue working. The theme is not using a CDN(both options error out for some reason) and I'm not sure why the local compile isn't working.

id flag
It is helpful to disable aggregation when getting console stack traces.
Jaypan avatar
de flag
Looks like bootstrap JS is not loading/loaded.
cn flag
blu
I think you're right but I'm not sure how to fix it. disabling Modals in the bootstrap theme settings lets it work but also stops modals.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.