How do I only accept valid responses in my form fields?

Modified on Mon, 28 Apr at 9:05 AM

Validation Rules help you control when and how fields in your form need to be filled out.  By default, all fields are required, but with Validation Rules, you can add conditions, making fields optional or ensuring they meet certain requirements.

Validation Rules allow 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 conditions that you have added.

Example

Imagine you only want to accept submissions from users with email addresses belonging to your organization.


You can create a validation rule for the Submitter Email field to ensure it contains your organization’s domain (e.g., @droplet.io).  If the email doesn’t include your domain, the submission will be flagged as invalid, prompting the user to correct their response before they are able to submit.

Build a Validation Rule

Let's build the email address validation rule together:


Here's how:


1

In the Form Editor, select a component and click Add validation rule? from the properties panel.

2

Use the rule builder interface to create one or more conditions.  First, select if the conditions will make the field valid or invalid. Then, configure rules as needed.

In our example, we will choose the Submitter Email field, the "contains" operator, and type in "@droplet.io" as the value.  This will force all responses in the Submitter Email field to contain the text "@droplet.io".

3

Press Apply Rule.

4

Consider previewing or testing your form to ensure that your newly configured validation rule is applying properly.


Advanced Validation Rules

For more advanced validation rules - like character limits or mathematical expressions - you can use Droplet AI to generate a rule expression for you, or write one yourself!

Use Droplet AI to Write Rules

1

In the same rule builder interface that appears, click Switch to Code in the upper-right corner.

2

In the top pink input, type in plain language what you would like to be checked for validity.
For example, "only valid when the value includes at least 20 characters"

3

Press Enter.  Droplet AI will think for a few seconds, and then generate a rule expression.  Apply the rule and test to ensure it is validating how you intend it to.

Write your Own Rule Expressions

Droplet has a variety of shortcuts (called Helper Functions) to make writing Validate Logic easier.  Think of them like Google Sheets or Excel functions. We have a full guide of our helper functions at the link below:

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article