Issue with gform_field_value_ hook for hidden field

Hello folks,

I am facing an issue with populating hidden field using the hook gform_field_value_ but it doesn’t work and value is empty

This is the field

On frontend, the field is empty

The hook is setup like

add_filter( 'gform_field_value_submission_id', [ $this, 'gf_parameter_submission_id' ] );

public function gf_parameter_submission_id( string $value ): string {
	$task_id = (int) get_query_var( 'task_id' );

	if ( ! $task_id ) {
		return $value;
	}

	$task = get_task( $task_id );

	if ( $task && $task['entry_id'] ) {
		return $task['entry_id'];
	}

	return $value;
}

I am getting the entry_id value, it can be seen in the logs but for some reason it doesn’t fill the hidden field

Is the site using a caching or optimization plugin or service? If the page where the form is embedded is cached, that will prevent dynamic population and default values from functioning correctly. We recommend excluding pages that include forms from caching/optimization.

Hi, the screenshot is from a local site, it doesn’t have cache setup, I tried adding query params to bust cache if that was the case but it didn’t help.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.