Versions Compared

Key

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


Section


Column

Customizing frevvo can be done in several different ways. It is important to consider all the alternatives available when deciding on a method to accomplish form customization.

Warning

Although JavaScript will accomplish the task, it is important to note that your scripts are not subjected to formal testing by the frevvo quality assurance team. Choosing an approach that is part of the frevvo product like Business Rules is a better choice than adding JavaScript since released versions undergo rigorous quality assurance testing. Customizations using JavaScript should only be used under special situations and if there is no other way to customize the form to the requirements.

For example, let's say you have a message control in your form that contains markup to pull a custom JavaScript. The URL for the script contains the frevvo home directory and revision number - (http://localhost:8080/frevvo/js-24487/libs/script.js).  An upgrade of frevvo to a new release or revision version could potentially stop the form from working.

If you choose to add JavaScript, we strongly recommend that you are familiar with a JavaScript debugger / web development tool for your browser.

Here  are some real world situations where custom JavaScript can be used in a form. The custom JavaScript can be added to the form using the message control or the includes.js file in the frevvo.war. Refer to Customizing Behavior and Common Methods for more information.


Column
width240px

On This Page:

Table of Contents
maxLevel1


...

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 Automaticallysubmitaform 1507406127, 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();

...

Code Block
titleBusiness Rule
if( getCusomterNameTrigger.clicked ){
  customerName.value = getCustomerName(http, customerId.value);
}

Auto Save Script

To avoid losing data if the user accidentally closes the window or if the form times out, you can add a custom javascript that will save the form at regular intervals. This script can be directly added on the form or worklow in a message control or to a project level include.js file. Please note that any data after the last save ran will be lost if the form is closed or timed out. Please set your timer accordingly.

Note

Please ensure that the Save/Load property is checked in the settings for this script to run successfully.

To add this script to a standalone form or workflow, add a message control to it . You can set the properties of the message control from the properties panel to Visible false and Printable false if you don't want it seen at runtime or printed in the final pdf. The variable "actualtimer" is the interval between each save. actualtimer=1 equates to 1 minute.  The script for a form and a workflow slightly differ. 

Script for a form,

Code Block
titleForm Script for Auto-save
<script>
var actualtimer = 1
var saveInterval = 1000 * 60 * actualtimer;
autoSaveForm = function ()
{
_frevvo.formView.getSaveButton().click();
setTimeout(autoSaveForm, saveInterval);
}
setTimeout(autoSaveForm, saveInterval);
</script>

Script for a workflow,

Code Block
titleWorkflow script for Auto-save
<script>
var actualtimer = 1
var saveInterval = 1000 * 60 * actualtimer;
autoSaveForm = function () {
FlowView.getSaveButton().click();
setTimeout(autoSaveForm, saveInterval);
}
setTimeout(autoSaveForm, saveInterval);
</script>

If you already have an include.js file or want to upload this script at a project level, just remove the <script> and </script> tags from the above code and make sure your include.js file has // frevvo custom JavaScript comment at the top of the file.


Info
titleAuto-save and Anonymous users

Anonymous users or users not logged into the system will be prompted to enter their email address when the save event is triggered.