Follow

Validator Tool

Validator Tool

Our Validator, simply stated, is a tool that checks calculations, rules, and script to make sure they are working correctly. Especially if you are writing scripts or calculations in a form, the first thing I check before I save and publish (and view on my device) is the validator tool. More times than not, I accidentally forget to place a $, or a ; in my calculation, and the validator tool shows me the faulty code. One thing the validator does NOT do is actually highlight the issues IN your calculations. It will instead give you a description about what the problem might be, then its up to you to go and find out what its talking about. One thing to note is that we are going to be revamping our validator tool in a future update to fix bugs, as well as improve capabilities.

Guidelines

Below is the “Pirate Code” (guidelines) of the validator tool.

  • The validator tool cannot be relied on to catch ALL issues in calculations, scripts, and rules. Rather, most of the time, it should guide you in the correct direction.
  • Because the validator is in its first version, it can make a big deal out of nothing. There are certain circumstances where it will show “errors” that may seem like they need to be rectified, but rather, its an area for you to look at for potential issues. I will give you an example of this in “Results” section below.

Start Validating

  1. Make sure you have the form you want to validate in the form builder, in your online portal.
  2. Select the grey (cogwheel) “Setup” button near the top of your screen
  3. A dropdown list will appear. Near the bottom select “Validate Form”

 

Results

  1. 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 stuff… Most often I will glaze over these “errors” if I see them in the validation. 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 from 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.

  2. "Invalid Target" (section) - RULE SPECIFIC. An invalid target with a section reference are most often "false positives". 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.

     

  3. No Target Set for Rule” - RULE SPECIFIC. This error is attempting to indicate that, in the rush of setting up your form, you accidentally missed a rule “target”. Click on the blue issue identifier, and it will take you to the rule you need to direct a target towards (see screenshot)

  4. ReferenceError:” - The validator finds a foreign symbol or misspelled function in the calculation field or script. For instance the 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.

  5. SyntaxError: Unexpected token return” - This could mean wrong operator, wrong placing of operator. Deals with : , ; $ {} [] () . all of those fun symbols… most likely if one of those is out of place the SyntaxError will catch it.

Have more questions? Submit a request

Comments

Powered by Zendesk