How do I use Validation Logic with my Form Fields?
  • 1 Minute to read
  • Dark
  • PDF

How do I use Validation Logic with my Form Fields?

  • Dark
  • PDF

Article Summary

By default, all fields on a form are required before the submission can be submitted. If you would like to make some fields optional or add logic to make them conditionally required, you can use the Validation Logic formula field. 

If you used the tool to create your form from a PDF, the Validation Logic formula field will be blank. If you added a component by dragging it onto the canvas, your formula field will look like the image above. Leaving the Validation Logic formula field blank or using our helper function to make this field required both have the same effect of requiring the field. 

The helper function below is the function you can use to require a field. Please note: the word "value" is used to let a component refer to itself so you can use this formula exactly as written. 


 The other commonly used helper function makes a field optional. This is helpful for information that is nice to have but shouldn't stop a submission if it isn't present. Note: this helper function does not need to reference the word "value" or any ID. 


There are a number of other helper functions as well as other Javascript that could be useful to create custom Validation Logic formulas. 


withinRange(value, min, max) 

equals(expected, actual)

notEquals(expected, actual)

isGreaterThan(num1, num2) 

isGreaterThanOrEqualTo(num1, num2)

isLessThan(num1, num2)

isLessThanOrEqualTo(num1, num2)

and(val1, val2)

or(val1, val2)

includes(list, value)

toCurrency(number) => string

fromCurrency(string) => number
Best Practices with Custom Validation
We recommend adding a tooltip or hint to fields with custom validation to help the user understand what they need to provide in order to submit. Another option would be to include a text field that uses an opposite display logic function so it appears like an error message when the validation logic fails. 

Was this article helpful?