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

Issue when populating values over multiple rows. #100

Open
mathieuhays opened this issue Aug 23, 2017 · 0 comments
Open

Issue when populating values over multiple rows. #100

mathieuhays opened this issue Aug 23, 2017 · 0 comments

Comments

@mathieuhays
Copy link

mathieuhays commented Aug 23, 2017

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant