Multi-input fields when using GFAPI::submit_form()

I’m using GFAPI::submit_form() to add entries. However the result is validation errors that do not appear when submitting the form normally.

The form has a few multi-input fields, such as ‘Name’ and ‘Address’. These fields only require a small subset of their inputs (e.g., I’m not using ‘Prefix’ or ‘Middle’ for the name field).

When I display the result of submit_form() I’m seeing validation errors. The errors reference the main ID of the field (i.e., they don’t specify the individual input’s id number like ‘2.6’ for ‘Last Name’; they specify just ‘2’).

I have tried adding the value ‘1’ to every sub-field that I’m not using in order to have something passed, but that didn’t work.

What am I doing wrong? How can I use submit_form() with these types of fields?

Can you share an example of the $input_values array you are passing?

Hi Richard,

Here’s an example of the array I’m passing for parameter 2. It’s a name field that includes the “filler” values I added to try to get it to validate. My first attempt included only input_1.3 and input_1.6

$inputValues = [
        'input_1.3' => 'First',
        'input_1.6' => 'Last',
        'input_1' => '1',
        'input_1.1' => '1',
        'input_1.2' => '1',
        'input_1.4' => '1',
        'input_1.5' => '1',
        'input_1.7' => '1',
        'input_1.8' => '1',


Have you tried the input IDs like this (I have not tested this yet but the complex fields normally use underscores rather than the periods you find when inspecting the form):

$inputValues = [
        'input_1_3' => 'First',
        'input_1_6' => 'Last',
        'input_1_1' => '1',
        'input_1_2' => '1',
        'input_1_4' => '1',
        'input_1_5' => '1',
        'input_1_7' => '1',
        'input_1_8' => '1',

I’ll give that a go, but the documentation says:

The input names expected by this function are identical to the input names found in the form markup


© 2008 - 2019. Gravity Forms is a project by Rocketgenius Inc.