Page 1 of 1
3.1.2 Update producing Javascript errors on code that was already working
Posted: 24 Jan 2017
by ebelford
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)
Re: 3.1.2 Update producing Javascript errors on code that was already working
Posted: 25 Jan 2017
by Dmitry Kozlov
Hi,
Make sure that you wrapped your code into the following:
Code: Select all
SP.SOD.executeOrDelayUntilScriptLoaded((function () {
// your code here
}), 'SP.js');
Re: 3.1.2 Update producing Javascript errors on code that was already working
Posted: 25 Jan 2017
by ebelford
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.
Re: 3.1.2 Update producing Javascript errors on code that was already working
Posted: 26 Jan 2017
by Dmitry Kozlov
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://spform.com/forms-designer- ... point-2010
Re: 3.1.2 Update producing Javascript errors on code that was already working
Posted: 27 Jan 2017
by ebelford
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.