Read form data at gform_pre_submission

Hi there,

I am unsure of how to read/access the field data in my function which hooks to gform_pre_submission (functions.php).
I am trying to read the list field entries before the form submits, so that I can use it to generate a CSV based on the list field data.

Thanks

You can access the $_POST at gform_pre_submission.

add_action( 'gform_pre_submission', 'pre_submission_handler' );
function pre_submission_handler( $form ) {
	GFCommon::log_debug( __METHOD__ . '(): The POST => ' . print_r( $_POST, true ) );
}

I ended up using the following, is there is it better to use one that the other?

add_action( 'gform_pre_submission', 'pre_submission_handler' );
function pre_submission_handler($entry, $form) {
    $myData = $entry[1];
}

At the time of pre_submission, the $entry is not known. Also, the gform_pre_submission filter only accepts one parameter, the $form. I’m not sure how your code would work?

I user “rgar” and it works great:

$company = rgar( $entry, ‘4’ );