Ask Your Question
0

How can one retrieve the value of a nested form entry in Gravity Forms?

asked 2022-09-22 11:00:00 +0000

lakamha gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-02-16 11:00:00 +0000

pufferfish gravatar image

To retrieve the value of a nested form entry in Gravity Forms, you can use the gform_get_meta() function. This function takes two parameters: the entry ID and the meta key.

First, you need to get the parent form entry ID. You can do this by getting the entry object and accessing its post_id property, like this:

$entry = GFAPI::get_entry( $entry_id );
$parent_entry_id = $entry->post_id;

Once you have the parent form entry ID, you can use it to retrieve the nested form entry meta value. The meta key is the field ID of the nested form field, followed by the string "id". For example, if the nested form field ID is "3", the meta key would be "3id". Here's an example of how to use gform_get_meta() to retrieve the nested form entry ID:

$nested_form_entry_id = gform_get_meta( $parent_entry_id, '3_id' );

You can then use the nested form entry ID to retrieve any other field values from the nested form, using GFAPI::get_entry() again.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2022-09-22 11:00:00 +0000

Seen: 17 times

Last updated: Feb 16 '22