Using Extra Field Values

What and Why

Extra field values allow you to capture pieces of data from the front-end form that can be accessed during processing. Unlike regular form fields, these values are not processed automatically by Ninja Forms. This makes them great for grabbing small bits of information that you might need to make processing decisions.

For example, you could use extra field values to capture the post ID of the post or page that the form is attached to or assign a unique ID number to each form.

Again, these won’t be processed by Ninja Forms, so you’ll need to write your own code to use the extra values you create.

How

It’s easy to create extra value fields; they are simply form inputs whose names begin with an underscore _. The underscore preface tells Ninja Forms not to processes these fields, but instead to add them to $ninja_forms_processing as extra values.

These special fields can be added using the Ninja Forms display hooks. The example below would output an extra value field containing the user’s IP address immediately after all the form’s fields were rendered.

Again, extra values can be very helpful if you are using custom processing and need to pass values without having them automatically processed.