I am working on using Gravity Forms to submit to a third party API. I have been reading the documentation for gform_after_submission and I can’t figure out how to refer to the fields in my form when I submit the values that are in the form. I am seeing things like this:
That means when form 93 is submitted, this hooks runs, and you have an $entry you can access, like this:
add_action( 'gform_after_submission_93', 'send_to_api', 10, 2 );
function send_to_api( $entry, $form ) {
// take what was submitted in field 21 of the entry and
// assign it to $some_variable
$some_variable = rgar ( $entry, '21' );
// do something with that variable
}
I used the helper function rgar to access to $entry:
Does that make sense? Because gform_after_submission runs after every form submission (of submissions for a specific form if you limit it like I did) you will have a single $entry where you can find all the information that was submitted in the form.
It does make sense. And helps a lot. Where I am stuck is how would I use the JSON file I have with those form IDs. That documentation helps but not with nested JSON. I’ve almost wanted to see if I can use the enqueue and then when the form submits I use Javascript since that is what I am more familiar with. But getting the IDs of each of the form elements to stay the same would be tricky.