-
SixPlusAsked on March 9, 2016 at 1:36 PM
I have downloaded the source code for my jotform so I can integrate it with my single page application using Angular (I can't use the iframe method because I need complete control over the form's html and so I can run custom analytics). Because this is a single page application, I only want Jotform's code to run when the user visits the specific page that the form is hosted on. So, when a user visits this page, the scripts sometimes load improperly. Here I've used jquery (i aliased it as $j because of the Prototype conflict):
Some of the time (like maybe 50-60% of the time), I get these errors:
Uncaught Error: prototype.js is required by protoplus.js. Go to prototypejs.org and download lates version.(anonymous function) @ jotform.forms.js?3.3.11814&_=1457547702283:3
Uncaught TypeError: Cannot read property 'setConditions' of undefined
jQuery should only be entering the .done function once all those scripts are retrieved. Can you help me make sense of this error
-
MikeReplied on March 9, 2016 at 3:19 PM
I assume that the error means that https://cdn.jotfor.ms/static/prototype.forms.js script is not loaded right, or the $ variable is still controlled by jQuery.
We had some issues with our CDN links today. It should be resolved, so can you please check if the errors are still there on your side?
-
SixPlusReplied on March 9, 2016 at 3:36 PM
I've been getting this error ever since I began using the full source code, and I still am getting it (happened once in the last 4 times I refreshed the page). I'm also running $.noConflict() before initializing any of the scripts
-
SixPlusReplied on March 9, 2016 at 3:50 PM
It seems like a completely unsustainable solution to throw a bunch of globals into people's code and hope that it meshes with their codebase, particularly when it conflicts with the most widely used front-end library. Is there no comprehensive solution to modularizing the Jotform code so that it does not pollute the global namespace while also making sure that users can control its functionality in the context of a single page application?
-
MikeReplied on March 9, 2016 at 6:00 PM
After some research, it appears that the issue is related to the asynchronous nature of the jQuery's getScript(). You may try options described in the following stackoverflow threads to see if that helps.
- jQuery getScript
- Can I use jquery getScript() without a callback?Unfortunately, we do not provide any other form source code solutions at this time. The Prototype JS has been used for many at JotForm, and it was originally selected as a best tool available back then.