Overview
FastField's Validator tool is a useful asset to have when writing scripts or calculations in a form. It helps to check that all your calculations, rules, and scripts are running smoothly - saving you the trouble of manually going through it!
Also, if the Validator tool discovers an issue, it will provide you with a description of the potential cause so that you can correct the issue.
How to Use the Validator Tool
- In the Form Builder, select Advanced Options near the top right of your screen.
- Select Validate Form.
- View the results of the validation. If any errors were found, a Validation Report will appear on the lower left corner.
- Select the blue text that is highlighted in the validator. This will take you straight to the section of your form where any problems were detected.
- After correcting the error, select the Revalidate button to quickly see if the error has been corrected.
Another great way to make sure your rules are working correctly is to use our Form Preview Function. It's an easy and convenient way to ensure your rules are giving you the results you're looking for.
Validator Tool Limitations
While the Validator tool will usually guide you in the right direction when an issue is discovered, it cannot be relied on to catch all issues related to calculations, scripts, and rules.
Because the validator is in its first version, it can sometimes make a big deal out of nothing. There are certain circumstances where it will show “errors” that may seem like they need to be corrected, but it's actually just an area for you to look at for potential issues (see Validation Report Results below.
Validation Report Results
Refer to this list of possible errors that may appear in your Validation Report.
- Field used but not defined: This is the most common “false positive” in the current form validator. It is intended to search the $field_keys$ in your calculation and make sure they are actually referencing REAL fields. This being said, it can sometimes find the wrong thing… Most often, you can glaze over these “errors” if you see them in the Validation Report. You will know if it is acting in error if it picks up something like this:
'$ == 'GREEN') setAlert('listpicker_20', 'SUCCESS'); else clearAlert($'
In this specific case, it finds the end of one field key (marked by the first $ symbol) and the beginning of the next field key and thinks everything in the middle is a unique field key. Here is a snippet of what the real calculation looks like:
'$listpicker_20$ == 'GREEN')
setAlert('listpicker_20', 'SUCCESS');
else
clearAlert($listpicker_20$);'
The highlighted fields above are the ACTUAL fields that are being referenced.
- Invalid Target (section) - RULE SPECIFIC: An invalid target with a section reference is most often a "false positive." This would be telling you to check your “target” for a specific rule that you have set. Feel free to double-check your target section to make double sure things are not set wrong, but if they are operating as they should in the app, go ahead and ignore this one.
- No Target Set for Rule - RULE SPECIFIC: This error is indicates that you accidentally missed the rule “target.” Click on the blue issue identifier, and it will take you to the rule you need to direct a target towards.
- ReferenceError: The validator finds a foreign symbol or misspelled function in the calculation field or script. For instance, this calculation:
'$numeric_24$x$numeric_33$'
This is improper because the “x” does not mean “multiply” in JavaScript. Instead, it should read:
'$numeric_24$*$numeric_33$'
If you validated your form in the first example, your validator would display:
'ReferenceError: $numeric_24$x$numeric_33$ is not defined'
This would give you a general idea that the issue is within this area.
- SyntaxError: Unexpected token return: This could indicate the wrong placement of an operator. It deals with ,; $ {} [] () (all of those fun symbols…) and most likely, if one of those is out of place, the SyntaxError will catch it.