Use a form to get a key based row and populate the rest of the form --

I am trying to create a Form that will allow a user to enter a Key Field and then execute a function that will retrieve all the elements for a PostgreSQL database for update if the Key value exists or initialize the form to capture / put new data. Carrying forward the entered data at a minimum.

The PHP, APIs and SQL are not an issue but how to set setup the Gravity Form with only the one field to execute the GET after the first (key) field is provided and the move on to the full form executing the PUT or Update after the second field. Been looking at a lot of documents and postings and getting list in the weeds.

TIA –

Hi @Rhett_Fleitz , Dario from Gravity Wiz here. Gravity Forms Populate Anything - Enable Dynamic Population - Gravity Wiz works for populating data from MySQL and MariaDB databases.

If you can use one of those, Populate Anything could be a big help here since it only works with what $wpdb supports (which by default is MySQL and MariaDB. PostgreSQL is currently not supported)

Using Gravity Flow could be an option worth considering.

  • The initial form only displays the key field. It would have the rest of the fields for postgres data set as administrative visibility.
  • Create a custom step type to perform the postgres lookup and store them into the administrative fields.
  • Use a user input step to then allow the entry creator to modify the remaining details as needed. Or include an email field on the initial step and steps can be assigned to that instead of a WP user or role.
  • Setting the form confirmation as a redirect that goes to an inbox page (with {form_id} and {entry_id} as query string parameters, would have the user experience that hitting submit button (labelled as next) goes directly to the user input step with the retrieved data.

Regards,
Jamie