# Wix Forms: Adding Custom Validations to Your Forms

Source: https://support.wix.com/en/article/wix-functions-adding-custom-validations-to-your-forms (updated 2026-10-05)
Related: Wix developer documentation, https://dev.wix.com/docs/llms.txt; Help Center index, https://support.wix.com/en/llms.txt

Add your own custom validation to verify the info visitors enter before they submit your form. Setting your own rules ensures that the data meets your requirements – some reasons for adding custom validation include:

* Verifying email addresses and ensuring two fields match.
* Restricting email address entries to numbers and letters only.
* Limiting accepted email aliases (e.g. only Gmail).

The first section of this article explains how to build a custom validation, and the second section provides a step-by-step guide for setting up an email address verification.

> **Important:** This feature is only available for the [new Wix Forms](https://support.wix.com/en/article/wix-forms-the-difference-between-the-new-and-old-wix-forms).

![screenshot of wix form, email verification field has fields do not match underneath.](https://d2x3xhvgiqkx42.cloudfront.net/12345678-1234-1234-1234-1234567890ab/21e446eb-7f73-4f2f-84b1-c6b77e64e45e/2024/12/12/d874fe76-289f-430f-928c-37963c27f8b1/7d88e226-156a-4795-83ac-3a2d1e68e9b5.png)

---

## Adding custom validation to your forms

Add custom validation to your forms to control the data that visitors submit. The function uses the form submission data to check if the form passes your defined validation and if not, applies your custom error message.

### To add custom validation to your forms:

1. [Go to Forms & Submissions](https://www.wix.com/my-account/site-selector/?buttonText=Go%20to%20Forms&title=Select%20a%20Site&autoSelectOnSingleSite=true&actionUrl=https://www.wix.com/dashboard/{{metaSiteId}}/wix-forms) in your site's dashboard.
2. Click **Edit** next to the form you want to update or [create a new form](https://support.wix.com/en/article/wix-forms-adding-and-setting-up-a-form-on-your-site).
3. Click the **Settings** tab at the top.
4. Scroll down to **Advanced form validations** and click **Create Validation** to open the function builder.
5. Click **Start from Scratch**.
6. Click the **Condition** step to add parameters to your function using if/else logic.
7. Set the function's output:  
   1. Click the **Output** step.  
   2. Set the validation error, including:  
         * **(Optional) Form field key:** Apply the error message to a specific field. If no field key is added, the error message shows below the submit button.  
         * **Error message:** Enter the error message shown when the custom validation isn't met.  
   3. Click **Add** to add the validation error.  
   4. (Optional) Click **+ Add Validation** to set another validation error.  
   5. Click **Apply** to save your output.
8. Continue creating your function to match your business needs, adding relevant conditions or actions.
9. Connect this function to the relevant form:  
   1. Click the **More Actions** icon ![](https://d2x3xhvgiqkx42.cloudfront.net/12345678-1234-1234-1234-1234567890ab/71d20af0-560e-44a5-bb38-bf3f513b58fa/2024/11/13/7c29e2b9-d5ce-41c3-980d-c5757325c7d2/baa9faee-7e86-4558-b090-bd37ecc104be.png) at the top right  
   2. Select **Function configuration**.  
   3. Click **Selected form 1** and then **+ Select**.  
   4. Select the relevant form and click **OK**.

![A screenshot of the function configuration dropdown in the function builder.](https://d2x3xhvgiqkx42.cloudfront.net/12345678-1234-1234-1234-1234567890ab/1d4b9a27-f0a5-449a-99cc-188228a9c725/2025/08/05/81501871-2e7c-44fc-853c-fb26e073d082/0ba83aa7-a6ae-48f7-ae35-abdfa96e31bb.png)

1. Enter a name for your function at the top left.  
**Tip:** It's only visible to you and helps identify the function in the dashboard.
2. Click **Activate** at the top right.

![screenshot of functions builder, untitled function name is highlighted.](https://d2x3xhvgiqkx42.cloudfront.net/12345678-1234-1234-1234-1234567890ab/21e446eb-7f73-4f2f-84b1-c6b77e64e45e/2024/12/12/f546991c-bf72-43e9-992b-35f53bc1ec9e/aefcd5a3-299e-467a-b932-5c9558495671.png)

> **Where can I find my form field key?** Go to the relevant form in the form builder. Click the **Advanced** tab in the field settings panel. Copy the field key provided and add to the function output.  
> ![](https://d2x3xhvgiqkx42.cloudfront.net/12345678-1234-1234-1234-1234567890ab/21e446eb-7f73-4f2f-84b1-c6b77e64e45e/2024/12/12/d98bebe4-2b17-472b-b60b-fa7abf6a8f6b/4bc5cf8d-2c0e-4452-ad4b-1669402eb3aa.png)

---

## Creating a function to verify email addresses

One common scenario for creating a custom validation function is to ensure that two email address fields match before allowing a form's submission. The steps outlined below guide you through the process of setting up this particular function.

> **Before you begin:** Ensure that your form includes two email address fields for validation. To clarify the purpose of the second field to visitors, we suggest [renaming the field title](https://support.wix.com/en/article/wix-forms-managing-your-form-fields) to something like 'Confirm your email' or 'Email verification'.
>
> ![](https://d2x3xhvgiqkx42.cloudfront.net/12345678-1234-1234-1234-1234567890ab/71d20af0-560e-44a5-bb38-bf3f513b58fa/2024/12/17/ff5334e6-d189-4155-8e11-45f9e34fc11c/22e0c7cc-9401-494b-ae10-3432ea276f0f.jpg)

### To create a function to verify email addresses:

1. [Go to Forms & Submissions](https://www.wix.com/my-account/site-selector/?buttonText=Go%20to%20Forms&title=Select%20a%20Site&autoSelectOnSingleSite=true&actionUrl=https://www.wix.com/dashboard/{{metaSiteId}}/wix-forms) in your site's dashboard.
2. Click **Edit** next to the form you want to update or [create a new form](https://support.wix.com/en/article/wix-forms-adding-and-setting-up-a-form-on-your-site).
3. Click the **Settings** tab at the top.
4. Scroll down to **Advanced form validations** and click **Create Validation** to open the function builder.
5. Select **Validate email address match before submission**.
6. Click **Use Template**.

![screenshot of email validation function set in wix functions](https://d2x3xhvgiqkx42.cloudfront.net/12345678-1234-1234-1234-1234567890ab/21e446eb-7f73-4f2f-84b1-c6b77e64e45e/2026/06/23/a1a0749f-95f3-43fd-990a-e7465b2b464b/ad08bdcd-781d-4f32-8ddd-6dbfb86fbf38.png)

1. Enter a name for your function at the top left.  
**Tip:** It's only visible to you and helps identify the function in the dashboard.
2. Click **Activate** at the top right.

---

## FAQs

Click a question below to learn more about custom form validations.

**Can I access the functions builder from my forms dashboard?**

If you already customized a form in the form builder and want to build a custom validation for that specific form, you can quickly access the functions builder from the **Settings** tab.

  
![](https://d2x3xhvgiqkx42.cloudfront.net/12345678-1234-1234-1234-1234567890ab/21e446eb-7f73-4f2f-84b1-c6b77e64e45e/2024/12/12/a5e7b2c2-7ab7-4381-9b80-e6a59739352d/96f2c3d0-cae5-4e48-b429-f65597def620.png)

**Can I test my form validation?**

Yes. You can test your form validation on your live site.
