BrightLeaf Digital Code Snippet Library

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

Prevent duplicate submission if multiple fields match existing entries

GOAL

Prevents duplicate submissions when a specific combination of fields (Name, Number, Date) matches an existing active entry. If a duplicate is found, shows custom messages on the relevant fields.

CONFIGURATION

  • $forms: Add your form ID as a key, and set the field IDs to check. Then set the corresponding error messages.
  • Optionally set the window_days key to limit check to recent entries. Leave at 0 to remove limit.

NOTES

  • All three fields must match to be considered a duplicate.
  • Dates are normalized to site timezone (Y-m-d) before searching.
  • Can be used for multiple forms by duplicating the inner array with a new form key, etc.
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.