Validate Logic allows you to control when a field in your form needs to be filled out a certain way — not just that they have a value, but that the value matches certain rules (logic) that you have added.
Example
Imagine you have a student ID number field on a staff form. You might want to make sure this field only accepts a certain number of digits, like exactly 6 characters for a valid ID. Or, for an expense report field, you may want to ensure that the number entered doesn’t exceed a specific limit, like $5,000.
The Easiest Way: Use Droplet AI
The easiest way to configure Validate Logic on your form fields is to use Droplet AI to write an expression for you!
Here's how:
In the Form Editor, select a component and click Validate Logic from the properties panel.
In the top pink bar, type the validation conditions you would like to apply to this field in plain wording, for example: "must be less than $200."
Press enter and await a response from Droplet AI. Accept its recommendation by clicking the Accept icon or by pressing Done.
Test your field to ensure it is adhering to the new Validate Logic you have added to it by Previewing/Debugging the form.
Droplet AI will be using some functions to write Validate Logic for you. If you'd like to know more about what it is writing or how you can write your own logic, keep reading about helper functions below.
Write Validate Logic with Helper Functions
Droplet has a variety of shortcuts (called Helper Functions) to make writing Validate Logic easier. Think of them like Google Sheets or Excel functions.
If you want to refer to the value of the field you’re adding validation to, you can either use the field’s component ID or simply use the word ‘value’ to refer to its own value.
Checks if two values match exactly
You can also use:
value === comparison
Checks if two values do not match exactly
You can also use:
value !== comparison
Verifies that a value falls between a minimum and maximum range
Confirms that one number is greater than another
You can also use:
value > comparison
Confirms that one number is greater than or equal to another
You can also use:
value >= comparison
Ensures that one number is smaller than another
You can also use:
value < comparison
The value must be less than or equal to a specific number
You can also use:
value <= comparison
Ensures that all conditions are true
You can also use:
condition 1 && condition 2
Allows for at least one condition to be true
You can also use:
condition 1 || condition 2
Checks if a value is part of a specific list
You can also use:
[list].includes(value)
Of course, we'd recommend just using a dropdown, radio button, or checkbox to narrow choices like this!
To Use Within Other Helper Functions
Marks the field as not required
To make a field optional, just turn off the Required switch in the field’s properties panel. However, if you need to make a field optional based on certain conditions, you can use this helper function.
The first test is "Is Next Action equal to Approve?" If so, this will require a value in the field. Otherwise, it will make it optional.
This tells you how many characters are in a value. For lists, it will tell you how many items are in the list.
Great for ID numbers and account codes!
Converts a number into a formatted currency string, like turning 5 into $5.00
This is especially helpful when used with other helper functions, if you need to format a number as currency.
Converts a currency string back to a number, like turning $5.00 into 5
This is especially helpful when used with other helper functions, if you need to format a currency value as a number first.
We recommend adding a tooltip or hint to fields with Validate Logic to help the user understand what they need to provide in order to successfully submit.
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article