Check Field Entry against Database or File Contents

Hello - I’m hoping someone can point me in the right direction with regards to a problem I am trying to solve.

Is it possible to have a Gravity Form which takes a field entry (such as a number), which upon submission checks to see if the number exists in a specified local database or file and then either populates the 2nd page of the form with the matching retrieved details for the record number or displays an error message?

I think this could be achieved using the gform_validation hook but I don’t have a clue where to start :frowning:

So I’d be really grateful for any help or pointers if possible please.


The gform_validation hook would be useful to confirm that the number does/not exist within the local database/file - i.e. to present a validation error to user when the value doesn’t exist. If you want to store values into the entry from that db/file you would want to use gform_pre_submission which docs page shows some examples of updating the $_POST values.

Depending on your use case, and how much data is being presented on different pages of the form, you might consider using Gravity Flow and its’ user input step type to break apart the form into discrete tasks for the user:

  • Provide order number + contact info as initial form submission with low engagement barrier
  • User Input step to review/edit the retrieved order details
  • Approval step to confirm they want to update/place new order


1 Like

Hello Jamie,

Many thanks for answering my question and for the guidance.

I will take a look at what you have suggested to see if it provides the solution that I am looking for in this case.

Thanks for your help again :grinning:

1 Like