You are viewing limited content. For full access, please sign in.

Question

Question

Forms - JavaScript not working after upgrade to 10.2

asked on March 15, 2017 Show version history

Hi, 

I would like to find out if Forms 10.2 references JavaScrip to be called inside a Form differently to previous versions? We have upgraded our Dev instance fro Forms 10.1 to Forms 10.2 Update 1 today to see if any of our current process will be effected.  We found that our existing Forms now seem to be unable to run the references JavaScript. 

 

When trying to run the first piece of script when a search is doen to find Customer information the following error occurs in the backround:

Uncaught TypeError: $.blockUI is not a function
    at ShowLoadingModal (eval at <anonymous> (jquerymin:1), <anonymous>:265:11)
    at ShowAndHideGeneralLoadingModal (eval at <anonymous> (jquerymin:1), <anonymous>:290:17)
    at GetCustomerInformation (eval at <anonymous> (jquerymin:1), <anonymous>:126:9)
    at HTMLInputElement.onclick (xQP59:1)

We also check other portions of the form where a calculation takes place using JavaScrip and the calculation no longer seem to work. No error is reported that we can see but the relevant fields that we would expect to update with the calculated values stay unchanged.  

The JavaScript is kept in a .js file stored on the Forms server and referenced in the forms as follows under the CSS and JavaScript tab of the Form.

The script files and mechanism still work fine in our QA and Prod environments that currently still run Forms 10.1. 

0 0

Answer

SELECTED ANSWER
replied on March 17, 2017

We found the problem.

It turns out that the one developer working on the process had added references to the view fields (_FormsLayout.cshtml and _Layout.cshtml) so that they would load by default and not have to be implemented in each Form created. So when we did the Upgrade those files got replaced with the default ones resulting in the behaviour we experienced. Once those references was put back, all the scripts worked like before.  

Thanks for all the responses though. 

0 0

Replies

replied on March 15, 2017

Hi Vincent, are you able to access the scripts through your browser when you type in the script URLs?

0 0
replied on March 15, 2017

While there were some changes to how custom JavaScript is executed in Forms 10.2, I don't have any issues using $.getScript and using functions defined in custom files saved to a subfolder of /Forms/js.

Building off of what Xavier had mentioned:

  1. If you type in the URL http://DEV_LF/Forms/js/AvisFleetCustom/Common.js into the navigation bar of the browser, do you indeed get the JavaScript file back?
  2. Are there any errors in the browser console (F12 > Console) when loading the form?
  3. You can use the followng code to further debug $.getScript :
    $.getScript(/* JS file URI */, function(data, textStatus, jqxhr) {
      console.log(data);
      console.log(textStatus);
      console.log(jqxhr.status);
    });

    This code will log to the browser console some information, in order:

    1. Any data returned from the request; if successful, this will be the contents of the requested JavaScript file.

    2. The status of the response; if successful, this will be the string 'success'.

    3. The HTTP status code of the response; if successful, this will be 200.

0 0
replied on March 15, 2017

I tested with similar script with Forms 10.2 update 1 and popup is a function defined in testapi.js, there is no problem to execute it.

$(document).ready(function () {

    $.getScript("http://v-sh-lf102/forms/js/util.js",function(){
     $.getScript("http://v-sh-lf102/forms/js/util.redirect.js",function(){
    $.getScript("http://v-sh-lf102/forms/js/testapi.js");
    });
    });
  $('#q92 input').on('click',clear);
  function clear()
  {  
  popup();
}
});

Where is the blcokUI defined in your script?

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.