Versions Compared

Key

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

...

Code Block
var CustomEventHandlers = {
   uploadEl: null,
   setup: function (el) {
       if (CustomView.hasClass(el, 'onlyPDF')) {
           this.uploadEl = el;
       }
       window.setTimeout('CustomEventHandlers.checkFile()', 3000); // set the initial timer
   },
   checkFile: function () {
       for (var i = 0; i < this.uploadEl.parentNode.childrenWithClassName('f-file-upload-file-name').length; i++) {
           if (!(/^.*\.(pdf|PDF)$/.test(this.uploadEl.parentNode.childrenWithClassName('f-file-upload-file-name')[i].getAttribute('title')))) {
               alert("Invalid file '" + this.uploadEl.parentNode.childrenWithClassName('f-file-upload-file-name')[i].getAttribute('title') + "' will be removed.");
               this.uploadEl.parentNode.childrenWithClassName('f-upload-file-list-delete')[i].click();
           }
       }
       window.setTimeout('CustomEventHandlers.checkFile()', 3000);
   }
}

Add onlyPDF to the Css CSS Class property of your Upload control to enable this JavaScript. 

...

Code Block
var CustomEventHandlers = {
   setup: function (el) {
       if (CustomView.hasClass(el, 'extra-submit')) {
           FEvent.observe(el, 'click', this.autoSubmit.bindAsObserver(this, el));
       }
   },
   autoSubmit: function (evt, el) {
       FlowView.getFlowButton().onclick();
   }
}

 

Prevent Session Timeout

The Use the following JavaScript to prevent the browser session from timing out. For example, the tenant session timeout is set to 30 minutes. One of your forms takes a long time to fill causing idle periods greater than 30 minutes where the user is not filling any forms.  Use the following JavaScript to prevent the browser session from timing out..  

Code Block
var sessionInterval = 1000 * 60 * 10; // milliseconds to minutes
var sessionRefreshURL = "/frevvo/web/login";

refreshFrevvoSession = function () {

   // make the request
   var xmlhttp;
   if (window.XMLHttpRequest) xmlhttp = new XMLHttpRequest(); // IE7+, Firefox, Chrome, Opera, Safari
   else xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); // code for IE6, IE5
   xmlhttp.open("GET", sessionRefreshURL + "?sessionRefresh=" + new Date().getTime(), true);
   xmlhttp.send();

   // set the timer to run again
   setTimeout(refreshFrevvoSession, sessionInterval);
}
setTimeout(refreshFrevvoSession, sessionInterval); // set the initial timer

...

' Quantity control allows only whole numbers. An error message will display if a number with a  decimal point value is entered. Instead of the error message, The forms designer can restrict users from entering a value with a decimal point using this JavaScript::.

Code Block
var CustomEventHandlers = {
        setup: function (el) {
            if (CustomView.hasClass(el, 'onlyDigits')) {
                FEvent.observe(el, 'keydown', this.allowOnlyDigits.bindAsObserver(this, el));
                FEvent.observe(el, 'keyup', this.allowOnlyDigits.bindAsObserver(this, el));
            }
        },
        allowOnlyDigits: function (event, element) {
            fldVal = $(element).value;
            for (var i = 0; i < fldVal.length; i++) {
                var nom = fldVal.charAt(i);
                if (isNaN(nom)) {
                    $(element).value = fldVal.substring(0, i) + fldVal.substring(i + 1, fldVal.length);
                }
            }
        }
    }
 

Add onlyDigits in the CSS Class property of the Quantity control. Now, whenever a user enters a decimal point, this This script will automatically remove it from a decimal points from the field and the error message will not display.  Similar logic can be used to implement instant validation on other control types as well.

...