2sic / app-mobius-forms

Simple jQuery based 2sxc form - to use immediately or to modify as needed. Multi-language, simple, with Recaptcha

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Uncaught TypeError: Cannot read property 'init' of undefined

birksy89 opened this issue · comments

The other issue I added (issue #10 ) stems from this...
Hence I installed a fresh instance of DNN 9.2 to try see if I could solve it...

Anyway - This is present in an established DNN site which recently upgraded to Evoq 9.2

The forms all now fail to load correctly and appears to be a jQuery issue.

They are running 2sxc 8.12.0 and an early edition of Mobius Forms.

The error is:

Uncaught TypeError: Cannot read property 'init' of undefined

This is the failing line:

$(function () { window.appJqF.init(); }); // init the form - must trigger in-line, in case the form was added w/ajax

As always, any help would be greatly appreciated

thanks. We'll look into it, but ATM we're pretty swamped so we won't have a quick solution. Since I presume it's a jquery issue which you can probably fix as well, any help from you would also be appreciated :)

Hi Daniel,

Sorry for wasting your time - In my effort to try and diagnose the problem, I started by turning off the "Client Resource Management" minification and bundling - Just so I could read the code a bit better.

Once I did this the problem went away.

Just to be sure, I re-enabled the setting, and incremented the version. The problem returned.

Do you think this is an issue with DNN 9.2? As the module works well (with client resource management on) on their "old" 8.0.4 site.

I'd be keen to hear your thoughts - Thanks again for your quick reply.
-Andrew

Hi @birksy89 thanks for the update.

It most likely something with the order of the files - how they are bundled. This could be because Moebius doesn't include an order - and the default behavior changed the sorting - or that the order isn't respected any more. Could you try to narrow that in? So basically:

  1. Does moebius have a file order set for the dependencies or not?
    1. if yes, is it respected by DNN?
    2. if not, does it fix itself if the order is added?

Hi Daniel,

The client site isn't really fit diagnose the issues on - Hence why I spun up a fresh install to try and get to the bottom of it - But then came across issue #10 .

Happy to do whatever I can to help and contribute to 2sxc!

Are the links below and the "data-enableoptimizations" tag similar to how you'd include a resource in a DNN Skin?

<script type="text/javascript" src="/desktopmodules/tosic_sexycontent/js/2sxc.api.min.js" data-enableoptimizations="100" ></script>
<link rel="stylesheet" href="@App.Path/dist/styles.css" data-enableoptimizations="100" />
<script src="@App.Path/dist/smoke.min.js" ></script>
<script src="@App.Path/dist/form-send.js" type="text/javascript" data-enableoptimizations="100" ></script>

Example of including skin tag with priority:
<dnn:DnnCssInclude runat="server" FilePath="dist/app.css" Priority="100" PathNameAlias="SkinPath" />

I'll see if I can get files and DB from client to set up a local copy of their site - But I'm generally worried about using the form in a blank 9.2 install...

Let me know how I can help
-Andrew

Yes, it uses the same priority - except that you can also specify "bottom" or "100:bottom" which gives you more control - check out https://github.com/2sic/2sxc/wiki/Template-Assets

Mobius app is still broken for me in 9.30 and dnn9.2.
Had to restore to old version.

@existenze I assume your issue is #13 and not this issue here. See latest notes there.

Nope. It's the init error. Exactly as described in the first post.

Dnn 9.1 with 2sxc 9.14 works fine. Upgrade to dnn 9.2 and 2sxc 9.30, this issue occurs.

ok, we'll look at this today or tomorrow. My guess is DNN 9.2 changes the order of JS files loaded, which causes this effect.

With DNN 9.2, ClientDependency version was updated which treats spaces in asset URLs wrong (in some circumstances). The @App.Path in the Mobius Forms App contains spaces, which causes that the app JS and CSS files are missing in the bundle.

We will implement a work-around in 2sxc. In the meantime, please try to prepend all script and style urls with a tilde ~:

<script type="text/javascript" src="/desktopmodules/tosic_sexycontent/js/2sxc.api.min.js" data-enableoptimizations="100" ></script>
<link rel="stylesheet" href="~@App.Path/dist/styles.css" data-enableoptimizations="100" />
<script src="~@App.Path/dist/smoke.min.js" ></script>
<script src="~@App.Path/dist/form-send.js" type="text/javascript" data-enableoptimizations="100" ></script>

Fix will be included in the next release: 2sic/2sxc#1566

@raphael-m this may not be of issue any more, but I thought I would document here.

I've just had chance to go back on the client site and look at this... Your solution above with the tilde (~) worked - But I had to exclude if from the smoke.min.js option:

<script type="text/javascript" src="~/desktopmodules/tosic_sexycontent/js/2sxc.api.min.js" data-enableoptimizations="100"></script>
<link rel="stylesheet" href="~@App.Path/dist/styles.css" data-enableoptimizations="100" />
<script src="@App.Path/dist/smoke.min.js"></script>
<script src="~@App.Path/dist/form-send.js" type="text/javascript" data-enableoptimizations="100"></script>

Not sure if it only needs to be applied with tags using the "data-enableoptimizations" or what... But just wanted to point out my findings for future readers.

Thanks

9.32 fixed the issues for me.
No need to correct code.

Thx