> For the complete documentation index, see [llms.txt](https://docs.senpiper.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.senpiper.com/form-builder/creating-forms/additional-form-settings/conditions/validate-field-values.md).

# Validate field values

This logic helps in creating some validation for taking in the values for a field. If the value entered in the field doesn't match the configured validation, an error message is shown to the user for the field and a successful submission cannot be created.

### What could be the use case?

Let's take an example. We have to set up a process for creating data on the students in a class above 18 years of age. We create a form with Student details like Name, Contact details, Address, etc. along with a field **Age** and set a validation on it that the **Age** entered cannot be less than 18 years.&#x20;

Now, while creating the submission for this form, the user cannot give a value less than 18 in the field **Age.** If the value entered in the field **Age** is less than 18 then an error message is given for the field **Age** if the user tries to submit the form and a successful submission is not created.&#x20;

### How do I set this up?

Getting back to our example explained above.&#x20;

1. While creating the above-quoted form, the user clicks on the **Settings** tab and select [<mark style="color:purple;">**Conditions**</mark>](/form-builder/creating-forms/additional-form-settings/conditions.md) from the left pane.
2. Select **Validate field values i**n the list of options shown.
3. Click on **Select Fields** and choose the field over which the validation is to be applied as shown in the below image. In our example, we have to apply validation on the field **Age.**

<figure><img src="/files/GBk9kLY7Yc9fcTGXuyYr" alt=""><figcaption></figcaption></figure>

4\. Write down the condition for the field in the input box. The user can write the javascript expression in terms of the field key in the input box marked <2>  in the below image or select the field in the formula box and give the condition as shown by <1> in the below image.

<figure><img src="/files/gRXXu9mxzZGIQv6mbkrE" alt=""><figcaption></figcaption></figure>

5\. Write down the error message that should be shown to the user filling up the form in case the field validation fails as shown in the image below.

<figure><img src="/files/whVDjRcN4C9cim7ZCytD" alt=""><figcaption></figcaption></figure>

6\. Click on **Save** to save the configuration and create the form by clicking on **Create form** in the **Build** tab.&#x20;

The form is created with the validation set on the field **Age** that the value entered cannot be less than 18.

So, while creating the submission if the user enters the value 16, the user can see the error message below the input box.

<figure><img src="/files/isiAfu7YSYEKcyz44FJK" alt=""><figcaption></figcaption></figure>
