Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Method 1 -  Add JavaScript to the custom.js file then upload it into your application.
  2. Method 2 -  Add a Message Control that contains your JavaScript.
  3. Method 3 - Add JavaScript to the include.js file located inside the frevvo war.

Method 1

...

Upload your custom JavaScript to  via the Scripts tab on the left menu inside your application. Follow these steps:

...

Tip

If your JavaScript does not behave as expected after upgrading your version of , it may be caused by a scrubbing of the custom.js file content by XSS protection. You may notice that all your code is on a single commented out line upon Inspection of the custom.js file. Upload an "unsrubbed" version of your custom.js file ,to solve the issue. In-house customers should refer to the Uploaded Custom JavaScript for Forms/Flows topic if you are planning an upgrade.

Method 2

...

Follow these steps to add JavaScript to your form using the Message control:

...

Code Block
 <script>
        /* <![CDATA[ */
        code goes here
        /* ]]> */
</script>

Method 3

...

Add JavaScript to the WEB-INF/rules/includes.js file located in the <frevvo-home>\tomcat\webapps\frevvo.war. Includes.js is only for including javascript into rules that run server-side. The contents of this file are included in the Rule Execution when the context initializes.

...

Here is an example of a snippet of code when added to the include.js will allow you to do something like this in a rule: DateControl?.value =MyUtil?.today();

Code Block
var MyUtil = {
    today: function() {
        var d = new Date();
        var dd = d.getDate();
        if (dd < 10) dd = '0' + dd;
        var mm = d.getMonth() + 1;
        if (mm < 10) mm = '0' + mm;
        var yyyy = d.getFullYear();
        return String(mm + "-" + dd + "-" + yyyy);
    }
}

If you wish to inject client-side script, the only option is to append your javascript into one of the minified js files in the frevvo.war. form.pack.js is one such file and can be found iafter after unzipping the frevvo.war in the /js-revision folder (revision being the 5-digit revision number of your build).

...