Site icon Hip-Hop Website Design and Development

Adding a new hidden field based on a condition in Ninja Forms

I am rendering Ninja Forms dynamically. By dynamically I mean the shortcode is coming from an ACF field, so at different pages, there would be different forms or multiple different/same forms on the same page. So it is like:

if ($nf_shortcode && $a_condtion){
  echo do_shortcode($nf_shortcode); //Render Ninja Form
}

What I am looking for is that when this Ninja Form is rendered, there is a new field or settings or anything attached to this form with a value from another ACF field. The purpose is to retrieve this value in my plugin on form submission.

add_action('ninja_forms_after_submission', 'my_ninja_forms_after_submission' );

function my_ninja_forms_after_submission( $form_data ){
     $form_id = $form_data['form_id'];
     //I want to retrieve that dynamically assigned value here
     //The other issue is that I cannot get post id of current page here.
     /*
     global $wp_query;
     $post_id = $post->ID; //This never returns a valid ID.
     */ 
}

The intent then is to redirect to another page with that dynamically assigned value as query parameter.

Any help would be appreciated. Thank you.