Modals Pro 12.5.0 generates JS error when modal...

Search
Other Bug Reports questions
Forum

Modals Pro 12.5.0 generates JS error when modal is invoked

John Bongiovanni's Avatar John Bongiovanni
This is the console output when I open the modal

modal.min.js?12.5.0.p:34 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'preventDefault')
at Modal.open (modal.min.js?12.5.0.p:34:7)
at Object.open (script.min.js?6f489755cec8b4f1d2629b2ae2344a31:16:7)
at CSCopenRLmodal (csc.js?6f489755cec8b4f1d2629b2ae2344a31:43:28)
at Object.success (cscmembertestlog.site.js?6f489755cec8b4f1d2629b2ae2344a31:158:21)
at c (jquery.min.js?3.6.3:2:28599)
at Object.fireWith [as resolveWith] (jquery.min.js?3.6.3:2:29344)
at l (jquery.min.js?3.6.3:2:80328)
at XMLHttpRequest.<anonymous> (jquery.min.js?3.6.3:2:82782)

The code of CSCopenRLmodal is doing this
RegularLabs.Modals.open (document.querySelector('#'+modalid));
John Bongiovanni's Avatar John Bongiovanni
I couldn't find a way in the RL Extensions Manager to revert the upgrade. Is there one?
Peter van Westen's Avatar Peter van Westen ADMIN
So this is an issue with the csc extension/script.
Please post a rating at the Joomla! Extensions Directory
John Bongiovanni's Avatar John Bongiovanni
While I'm debugging it, can I get a download of the prior modals version to keep the site running?
John Bongiovanni's Avatar John Bongiovanni
Hi Peter,

Here's what I'm seeing. I'm using the method you recommended to open a modal from JS
regularlabs.com/forum/modals/49996-j4-mo...pening-modal-from-js

It's failing in modal.open
The link parameter to RegularLabs.Modal.open is correct
modal.open is being called with null slide and event params

The failure is on the statement
event.preventDefault();
as event is undefined

Am I using the correct way to open a modal from JS?

TIA.
Peter van Westen's Avatar Peter van Westen ADMIN
Please try the latest development version from:
regularlabs.com/development-releases
Please post a rating at the Joomla! Extensions Directory
John Bongiovanni's Avatar John Bongiovanni
I am able to open the modal. However, something else there no longer works.
This is an iframe modal, and before I open it, I set the URL in JS. I do this by getting the modal element (same ID as I use to open it) and setting href attribute. This no longer takes.
Specificall I do this
modalControl.attr('href', urlValue)
where modalControl is the element
Is there a better way to do this?
Peter van Westen's Avatar Peter van Westen ADMIN
That is pretty much down to your custom javascript and how you are initially opening the modal.
Seeing you coded that yourself before, you can probably figure it out for how to do that with the Joomla 4 version of Modals.
If not: Do you have this online so I can take a look?
Please post a rating at the Joomla! Extensions Directory
John Bongiovanni's Avatar John Bongiovanni
I figured it out, thanks. The change in 12.5.0 was to use the originalHref property, which I then had to set before opening the modal.
You can only post on this forum if you log in