Versions Compared

Key

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

...

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

If you choose to use the Message Control with a Script tag to load your custom JavaScript for custom fonts, you must add your code inside the Script tag then add the HTML after the Script tag.

Excerpt
hiddentrue

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.

You can add any JS that you want with the following caveats:

  • It is not supported by frevvo.
  • It is not guaranteed to be backward-compatible i.e. in the next version, you may have to change this. 

Follow these steps to add JavaScript to the includes.js file:

  1. Stop Live Forms if it is running. 
  2. Change the file extension from .war to .zip if necessary and unpack the frevvo.war file to a temporary location of your choice: e.g. c:\tmp\frevvo-war. 
  3. Navigate to c:\tmp\frevvo-war\frevvo\WEB-INF\rules.
  4. Edit the include.js file and add your custom JavaScript. Save the changes to the include.js file. 
  5. Rezip all the files in the c:\tmp\frevvo-war directory, even the ones you did not edit — if you change directories or zip them differently, Live Forms may not load correctly.

  6. Change the file extension from .zip to .war, if necessary. Copy the updated frevvo.war file to <frevvo-home>tomcat\webapps.
  7. Restart your Live Forms server.

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 unzipping the frevvo.war in the /js-revision folder (revision being the 5-digit revision number of your build).

Warning

You should not assume the availability of JavaScript libraries in your Custom Javascript handlers. Functions should be part of the standard JavaScript environment. A good reference for what is and is not in standard JavaScript can be found here(Core Javascript) and here: (browser DOM reference).

...