I’m hoping someone can offer ideas to the following, any thoughts would be gratefully received:
I have a multi-page form where a user selects an option on page 1 will auto create X number of entries and list in a nested form field on page 2
Using gform_post_paging I can prepare everything, get my data ready to create X entries to go in the nested form field.
The issue I’m having is that the multi-page entry has no ID yet as it hasn’t been saved.
I can create my nested entries using GFAPI::create_entry() but I cannot populate the field ‘GPNF_Entry::ENTRY_PARENT_KEY’ to associate the nested entry with the current multi-page entry been created.
Below is my script with the field in question:
$new_child_entry = array(
'form_id' => 123,
'created_by' => 1,
'1' => 'Test',
GPNF_Entry::ENTRY_PARENT_KEY => 'No Idea what to put here!',
GPNF_Entry::ENTRY_PARENT_FORM_KEY => 149,
GPNF_Entry::ENTRY_NESTED_FORM_FIELD_KEY => 10
);
$child_entry_id = GFAPI::add_entry( $new_child_entry );
I think that nested form entries generates a temporary ID until an entry is saved - Maybe I need to grab this?
Many thanks in advance