3

I have a form say Form_ID=9. I want to edit Field_id:50 (lable: status) of a specific submission say Sub_id:160.

I can access that piece of information with custom code on a custom template page (front-end) but couldn't find a way to Update (or edit or modify, whatever you say) a field in a particular submission. Even Ninja Support refused to help.

Any CODE NINJA who could help?

Khawar.Y.
  • 61
  • 6

1 Answers1

2

Finally figured it out. Please note now I am using Ninja Forms 3.0.2 and this approach is for 3 on-wards (not tested < v3).

This is how to edit a field in as already saved form:

$result = Ninja_Forms()->sub( $sub_id )->update_field( 50, $status );

So for my example above it will become:

$result = Ninja_Forms()->sub( 160 )->update_field( 50, $status ); // 50 is field id and $status is the updated value.

Enjoy..

Khawar.Y.
  • 61
  • 6
  • Khawar.Y. - this looks like what I've been trying to do with Ninja Forms 3.2.1. I need to change the value of a hidden field that is reported in the success message (via a merge tag). I think I figured out how to get the field_id, but how did you determine the sub_id? – Tony Oct 13 '17 at 13:00