3.1.2 Update producing Javascript errors on code that was already working

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
Locked
ebelford
Posts: 10
Joined: Mon Aug 15, 2016

24 Jan 2017

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)

User avatar
Dmitry Kozlov
Site Admin
Posts: 1524
Joined: Thu Jun 07, 2012

25 Jan 2017

Hi,

Make sure that you wrapped your code into the following:

Code: Select all

SP.SOD.executeOrDelayUntilScriptLoaded((function () { 
  // your code here 
}), 'SP.js'); 

ebelford
Posts: 10
Joined: Mon Aug 15, 2016

25 Jan 2017

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.

User avatar
Dmitry Kozlov
Site Admin
Posts: 1524
Joined: Thu Jun 07, 2012

26 Jan 2017

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

ebelford
Posts: 10
Joined: Mon Aug 15, 2016

27 Jan 2017

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.

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 18 guests