3.1.2 Update producing Javascript errors on code that was already working

rss

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 Kozlov
    Dmitry Kozlov
    Admin
    Member for: 5 years 9 months 26 days
    #1 by Dmitry Kozlov Jan 25 ’17 at 06:05

    Hi,

    Make sure that you wrapped your code into the following:

    SP.SOD.executeOrDelayUntilScriptLoaded((function () { 
      // your code here 
    }), 'SP.js'); 
    
  • ebelford
    Member
    Member for: 2 years 11 months 14 days
    #2 by ebelford Jan 25 ’17 at 07:34

    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 Kozlov
    Dmitry Kozlov
    Admin
    Member for: 5 years 9 months 26 days
    #3 by Dmitry Kozlov Jan 26 ’17 at 08:32

    [#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

  • ebelford
    Member
    Member for: 2 years 11 months 14 days
    #4 by ebelford Jan 27 ’17 at 07:45

    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.

Displaying 1 to 4 of 4 messages