Versions Compared

Key

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

...

If you upload custom JavaScript to the tenant and then upload a different custom.js file to an application, will load both files. The functionality of both scripts will be available to a designer creating forms/flows in the application. For example, let's say you upload custom JavaScript to change the first letter of each word typed into a field to upper case.The class name is CorrectCase. You upload your custom JavaScript to the tenant.

Expand
titleClick here for an example of the Correct Case JavaScript
Code Block
// frevvo custom JavaScript
var TenantCustomEventHandlers = {
   setup: function (el) {
       if (CustomView.hasClass(el, 'CorrectCase')) {
           FEvent.observe(el, 'input', this.doCorrectCase.bindAsObserver(this, el));
       }
   },
   doCorrectCase: function (event, element) {
       var val = element.value;
       var str = val.toLowerCase();
       var spl = str.split(" ");
       var upstring = "";
       for (var i = 0; i < spl.length; i++) {
           try { //onkeypress will cause an error on first keypress
               upstring += spl[i][0].toUpperCase();
           } catch (err) {}
           upstring += spl[i].substring(1, spl[i].length);
           upstring += " ";
       }
       element.value = upstring.substring(0, upstring.length - 1);
   }
}

You create another custom script to add the dashes to the Social Security Number as the user is typing. The class name is SSN1. You upload this custom script to an application.

Expand
titleClick here for an example of the JavaScript to add dashes to the SSN
Code Block
// frevvo custom JavaScript
var CustomEventHandlers = {
    setup: function (el) {
        if (CustomView.hasClass(el, 'SSN1')) {
            FEvent.observe(el, 'keydown', this.formatSSN.bindAsObserver(this, el));
            FEvent.observe(el, 'keyup', this.formatSSN.bindAsObserver(this, el));
        }
    },
    formatSSN: function (event, element) {
        if (event.keyCode != 46 && event.keyCode != 8) {
            fldVal = element.value;
            var nom = fldVal.charAt(fldVal.length - 1);
            if (isNaN(nom) && nom != "-") {
                element.value = fldVal.substring(0, fldVal.length - 1);
            } else {
                if ((fldVal.length == 3) || (fldVal.length == 6)) {
                    element.value = fldVal + "-";
                }
                if (fldVal.length >= 12) {
                    element.value = fldVal.substring(0, fldVal.length - 1);
                }
            }
        }
    }
}

A designer creating forms/flows in the application will have access to both custom scripts. Both scripts will function properly.

Image Added

Uploading custom.js files with the same class name on the application and tenant levels

...