Skip to content
This repository was archived by the owner on Jan 13, 2018. It is now read-only.
This repository was archived by the owner on Jan 13, 2018. It is now read-only.

Issue when populating values over multiple rows. #100

@mathieuhays

Description

@mathieuhays

Hi,

I'm pre-populating values using the gform_field_value_param1 filter where I change the 1 depending on the row I want to populate. I also use a similar hook to populate the start value of the repeater field so the rows are there to be populated.

I went through the source code and it seems to work fine until the data reached the gfRepeater_getRepeaters function in the gf-repeater.js.

From what I understand (the relevant logic seems to start at line 193), the script seems to look for the value based on the id but data is arranged using row indexes instead.

In my case it can be fixed by changing the line 320 (line 270 in the version available on WordPress.org) of class-gf-field-repeater.php from:

$repeater_children_info[$repeater_child]['prePopulate'] = $repeater_parems[$repeater_child];

to:

$repeater_children_info[$repeater_child]['prePopulate'] = $repeater_parems;

Even though it fixes it for me I don't know if it has the potential to break other use-cases.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions