BrightLeaf Digital Code Snippet Library

Check out our growing library of code snippets for Gravity Forms!

Prevent selected fields on child form having the same value

This code snippet prevents duplicate values in selected fields within a Gravity Forms nested (child) form. It ensures that specific fields in child entries do not have the same values as other child entries within the same parent form. If a duplicate is detected, the form blocks submission and displays a custom validation message.

For each form that you would like to use this snippet for duplicate the array on the top of the snippet. The id in the first part of the array is for the child form id. Inside of that array add as many fields as you would like with the message for each field in the format of 3 => 'message', .

Features

  • Prevents duplicate values in selected child form fields.
  • Works with Gravity Forms Nested Forms to enforce unique values within a batch of child entries.
  • Validates multiple field types, including numbers, names, and dates.
  • Displays a custom validation message for each field when a duplicate is found.
  • Checks against other child entries in the same session, ensuring data uniqueness within a parent form.
  • Customizable per form and field, allowing flexibility for different forms and validation rules.
Install Using Code Snippets

This code is best installed directly on your site using the Code Snippets plugin.

Check Out the Code

Loading...

Code Copied!
Stay Updated On This Snippet

This entry has no reviews.