The Tap Forms Pro scripting engine is a very powerful way of interacting with and manipulating the data in your forms. There are three places you can add scripts in Tap Forms Pro. You can add a Script Field to any form. You can add a Script directly to a form. And you can add a Script to your Document as a whole.

For information on scripting in Tap Forms Pro in general, please see the Scripting topics.

Script Fields are similar to Calculation Fields in that your script can be triggered when a field’s value you reference in your script is modified in your form. They are generally used to perform calculations on just the selected record. For example, if you had a function which joined the First Name and Last Name together to return the Full Name, the Full Name script would run whenever you modified the value of the First Name or Last Name fields in your form.

To add a Script field to your form:

  1. Open the Forms sidebar and click “Fields
  2. Click the + button to add a new field
  3. In the dropdown menu, choose the Script field type

After you’ve added the Script field to your form, you can begin editing your script. In the Form sidebar under “Fields”, scroll to the Script section and click “Edit Script…”. Or just double-click the script field in the list of fields.

Here, you’ll be able to input your own custom scripts, as well as use snippets and available fields to help you in the process. As you work, you can choose how you’d like the result to be returned to the field (number, date, text, etc.) When you’ve finished, clicking Save will save the script code into your field.

Hidden Script Fields:

One interesting thing about Script Fields is you can hide them. When a Script Field is hidden, it will still run whenever you change a value of a field the script references. This can be handy for having Tap Forms allow you to do things like grouping your records into different sections based upon the value of another field in your form, such as a Checkmark field.

For example, take this script which returns Already bought or Need to buy depending on the value of the Purchased checkmark field:

function Bought_Or_Need_To_Buy() {
   var purchased = record.getFieldValue('fld-416ea84fba714f2c948ee8c2db06ddd4');
    if (purchased == true) {
        return "Already bought";
    } else {
        return "Need to buy";
    }
}
Bought_Or_Need_To_Buy();

You could use this Script Field for the `Group Records By` setting on your form to have Tap Forms Pro automatically group your grocery shopping items into these two sections. Then when you ar at the grocery store and you tap on the Purchased check, Tap Forms Pro will automatically move the items into the appropriate sections.

An example of this script is in the Grocery Shopping List form in the Tap Forms Pro Template Library.

To hide a Script Field (or any field), select the field on the Fields inspector panel, then click the Hide Field checkbox button.

Last modified: Dec 26, 2024

Need more help with this?
Don’t hesitate to contact us here.

Was this helpful?

Yes No
You indicated this topic was not helpful to you ...
Could you please leave a comment telling us why? Thank you!
Thanks for your feedback.