# Where/how to implement gform\_field\_validation

**URL:** <https://community.gravityforms.com/t/where-how-to-implement-gform-field-validation/5832>\
**Category:** Get Help\
**Tags:** gform\_field\_validation\
**Created:** [August 21, 2020, 12:05am UTC](https://community.gravityforms.com/t/where-how-to-implement-gform-field-validation/5832 "2020-08-21T00:05:50Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![user5f3763d8c7c7b586](https://avatars.discourse-cdn.com/v4/letter/u/d9b06d/32.png) [@user5f3763d8c7c7b586](https://community.gravityforms.com/u/user5f3763d8c7c7b586)\
**Post date:** [August 21, 2020, 12:05am UTC](https://community.gravityforms.com/t/where-how-to-implement-gform-field-validation/5832/1 "2020-08-21T00:05:50Z")

</div>

I’m trying to implement a validation across two fields where a user is required to enter their Parent/Guardian’s email address as well as their own.

The purpose of validation is to ensure the same email address is not entered in both fields.

I have narrowed down what seems to be what I need … but I can’t work out where and how to implement/call it. It has been added to the functions.php file within the Child theme (or does it need to go in the main theme?)

`add_filter( ` `'gform_field_validation_1_5'` `, ` `function` `( ` `$result` `, ` `$value` `, ` `$form` `, ` `$field` `) {`  
` ` `$master` `= rgpost( ` `'input_21'` `);`  
` ` `if` `( ` `$result` `[` `'is_valid'` `] && ` `$value` `== ` `$master` `) {`  
` ` `$result` `[` `'is_valid'` `] = false;`  
` ` `$result` `[` `'message'` `] = ` `'Please enter a different email.'` `;`  
` ` `}`  
` ` `return` `$result` `;`  
`}, 10, 4 );`

---

<div class="post-metadata">

**Author:** ![user5f3763d8c7c7b586](https://avatars.discourse-cdn.com/v4/letter/u/d9b06d/32.png) [@user5f3763d8c7c7b586](https://community.gravityforms.com/u/user5f3763d8c7c7b586)\
**Post date:** [August 21, 2020, 12:17am UTC](https://community.gravityforms.com/t/where-how-to-implement-gform-field-validation/5832/2 "2020-08-21T00:17:02Z")

</div>

Never mind … as I’ve just worked out — this runs when the form is submitted.  
Is there a way to have the validation run as data is being entered, or is that bad practice?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![chrishajer](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/chrishajer/32/88_2.png) [@chrishajer](https://community.gravityforms.com/u/chrishajer)\
**Post date:** [August 21, 2020, 2:01am UTC](https://community.gravityforms.com/t/where-how-to-implement-gform-field-validation/5832/3 "2020-08-21T02:01:39Z")

</div>

Hi Paul. The gform\_field\_validation filter runs after the form or page is submitted. There is currently no live validation in Gravity Forms. We have an open feature request for that, but it’s not currently a feature of the plugin.

There is a third party plugin which might be able to do this for you. I’ve never used it but it might be worth a look:

> **[BSK Gravity Forms Custom Validation](https://wordpress.org/plugins/bsk-gravity-forms-custom-validation/)**
>
> The plugin help you validate users input and let users submit right data on gravity forms form. You may apply defined users to your order form, regist …

---

<div class="post-metadata">

**Author:** ![user5f3763d8c7c7b586](https://avatars.discourse-cdn.com/v4/letter/u/d9b06d/32.png) [@user5f3763d8c7c7b586](https://community.gravityforms.com/u/user5f3763d8c7c7b586)\
**Post date:** [August 21, 2020, 2:38am UTC](https://community.gravityforms.com/t/where-how-to-implement-gform-field-validation/5832/4 "2020-08-21T02:38:26Z")

</div>

Thanks Chris. No real drama on the live validation — our needs on this project are met (and surpassed) with Gravity Forms as is.

Thanks 🙂

---

<div class="post-metadata">

**Author:** ![richardw8k](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/richardw8k/32/2354_2.png) [@richardw8k](https://community.gravityforms.com/u/richardw8k)\
**Post date:** [January 4, 2022, 5:56pm UTC](https://community.gravityforms.com/t/where-how-to-implement-gform-field-validation/5832/5 "2022-01-04T17:56:43Z")

</div>


