Section | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
...
Add my-scroll to the CSS Class property of the Trigger control which navigates the user to the second tab. the user to the second tab.
Set focus on a control when the form loads
You may want to set the focus (or cursor position) on a certain control when the form loads. This allows users to start entering data without a mouse click or tab action to reach the control they need to fill. Use this JavaScript to set the focus on a control with the CSS Class 'setFocus'.
Code Block |
---|
// frevvo custom JavaScript
var CustomEventHandlers = {
setup: function(el) {
if (CustomView.hasClass(el, 'setFocus')) {
el.focus();
}
}
} |
Add setFocus to the CSS Class property of the control you want to focus on when the form loads.
Note |
---|
This behavior will only be present when the form is opened using a share URL - you will not see it in Test mode. To test it, copy the form's share URL and paste it into a new browser tab. |
Automatically submit a form
This JavaScript example is relevant to Forms only. Let's say you have a new customer registration Form A that is normally forwarded to Forms B and C to complete registration for a new user. Returning Users skip Form B and go directly to form C.
This JavaScript example will automatically submit a form if a certain control has some specific value (say “not-new”) in it when the form is loaded. This might be useful in cases where a form needs to be submitted to post the data in it, but interaction between the form and user is not necessary. If the user's input is not required, this custom JavaScript can submit the form automatically.
...
Workflow steps only allow for one Activity Document Action (ADA), but there are cases where you may want to configure a second ADA (such as a second email) from the same workflow step. If the step is at the end of the workflow, you can use Workflow Doc Actions to accomplish this task. For steps in the middle of a workflow, create an additional linked step, set up the second ADA on the added step, and then use a script to automatically submit that step so the users will not see it. The script is similar to that for Auto-Submit a Form, but one key difference is that you will need a rule on the form that sets your conditional-submit control to the value specified in the script ("next" in the example below) on the step that should auto-submit, and then use the else action to set that control to empty on all other steps. Add conditional-submit to the CSS Class property of the control whose value is to be compared.
...
This JavaScript example will submit the form when the user presses the Enter key. If you want to do this in a workflow, change SubmitView.doSubmit("Submit"); to FlowView.getFlowButton().onclick();
...
Sometimes you may need the session timeout for a particular form to be a lot longer than the default session timeout that makes sense for your entire tenant. Imagine your tenant session timeout in is set to 30 minutes. One of your forms takes a long time to fill out. You want to allow idle periods greater than 30 minutes for that form only.
This JavaScript will change refresh the session timeout for this form to 10 hoursevery 25 minutes so it never hits the 30-minute session timeout. Change the variable sessionInterval in the script to the desired time period, for example, a 4 hour 25 minute session timeout refresh would be: var var sessionInterval = 1000 * 60 * 4; 25.
Code Block |
---|
var sessionInterval = 1000 * 60 * 1025; // 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 |
Info |
---|
In the above Custom js you can also use /frevvo/heartbeat in place of /frevvo/web/login. |
Auto Control Validation
has built-in validation that will instantaneously display an error message, the control background color will turn yellow and you will see a warning icon on the right side of the control when invalid values are entered. For Example, the Quantity control allows only whole numbers. An error message and a warning icon will display and the background color of the control will change to yellow if a number with a decimal point is entered. The forms designer can restrict users from entering a value with a decimal point using JavaScript. The script below will automatically remove a decimal point 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.
...
Code Block | ||
---|---|---|
| ||
var CustomEventHandlers = { setup: function(el) { if (CustomView.hasClass(el, 'PhoneInsert')) { FEvent.observe(el, 'keydown', this.formatPHONE.bindAsObserver(this, el)); FEvent.observe(el, 'keyup', this.formatPHONE.bindAsObserver(this, el)); } }, formatPHONE: 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 == 7)) { element.value = fldVal + "-"; } if (fldVal.length > 12) { element.value = fldVal.substring(0, fldVal.length - 1); } } } } } |
...