3.1.2 Update producing Javascript errors on code that was already working
Posted by ebelford - Jan 24 ’17 at 03:32
I updated Forms Designer to 3.1.2 when prompted today to update a NEW form that has extensive javascript on it. I made no changes to the javascript, but now I am getting errors.
The error reads:
Uncaught TypeError: Cannot read property 'get_current' of undefined
at isCurrentUserInGroup (fd_Item_NewForm.aspx:578)
at HTMLDocument.<anonymous> (fd_Item_NewForm.aspx:645)
at j (plumsail.fd.jquery.js:1)
at Object.fireWith [as resolveWith] (plumsail.fd.jquery.js:1)
at Function.ready (plumsail.fd.jquery.js:1)
at HTMLDocument.J (plumsail.fd.jquery.js:1)
-
Dmitry KozlovAdminMember for: 8 years 7 months 25 days
Hi,
Make sure that you wrapped your code into the following:
SP.SOD.executeOrDelayUntilScriptLoaded((function () { // your code here }), 'SP.js');
-
ebelfordMemberMember for: 5 years 9 months 14 days
I'm a little confused by this.
I have the exact same code on another list that is executing as expected, yet it was saved using the previous version of Forms Designer.
Is there something different about the new version that requires this wrapper to work? If so, I am going to have to add this wrapper to each segment of already working code if I ever want to make edits to those forms.
-
Dmitry KozlovAdminMember for: 8 years 7 months 25 days
[#2]: Nothing has change in this part of JS-framework. Without wrapping, the code works intermittently depending on whether sp.js is already loaded. Even in our very old sample, you can find the executeOrDelayUntilScriptLoaded function:
http://formsdesigner.blogspot.com/2013/03/how-to-create-dynamic-forms-with-forms.html
-
ebelfordMemberMember for: 5 years 9 months 14 days
Thank you Dmitri. I added the code to my form and it is now working. I will go back and add it to all of my previous forms and make this part of my practice moving forward.