Section | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
...
- If a designer uploads a custom.js file to an application, it is only available for forms/flows in that application. Refer to Method 1a below for the details.
- If a superuser/tenant admin uploads custom.js to the tenant, then the custom.js will be available to all forms/flows in the tenant. Refer to Method 1b below for the details.
Note |
---|
Custom.js scripts can be uploaded at two levels in :
|
Method 2 - Add a Message Control that contains your JavaScript. Refer to Method 2 below for the details.
...
Your custom JavaScript must contain the comment // frevvo custom JavaScript as the first line of the file or the upload will not be successful. Note the TenantEventHandlers JavaScript object. Tenant level custom js requires that you create a JavaScript object called TenantCustomEventHandlers.
Here is an example of code that will add dashes to a Social Security number control as the user is typing it in. See Custom JavaScript Examples for information on this sample code. Notice the JavaScript comment is the first line in the script file.
Login to as a superuser/tenant admin. Navigate to the Manage Tenant screen. Click the Manage Script link.
Browse your hard drive for you script file, Click Upload. Your file will be uploaded and it will display with the name Custom Script even though your script file may have another name.
Warning Be Aware that existing JavaScript files will be overwritten. Download the existing custom.js file, append your new code to existing code then upload the combined file if you want to preserve the existing JavaScript
If you need to modify the script, you must download it, make your modifications and then upload it again. When you download the script by clicking on the
Download icon, it will be named tenantcustom.js.Once you have uploaded the JavaScript, it is available for all designers in your tenant to use in their forms/flows.Remember to add the CSS class name to your form controls or your JavaScript may not work.
Here is an image of an Employee Information form using uploaded JavaScript to enter dashes in the Social Security Number field while the user is entering the data.
...
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 | ||
---|---|---|
| ||
Method 3Add 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:
Follow these steps to add JavaScript to the includes.js file: |
...
|
...
|
...
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();
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).
|
What can you do in a handler
...