Determine Position of Repeater Field

I successfully have the repeater fields working via having programmatically added them in the functions.php file, but how can I control where they appear on the form itself? They always show as the last fields on my form.

I do see the repeater field appear in the visual form editor after I created it and figured maybe you just drag that to where you want, which it does let you, but when you save the form it just reverts back to last in the form.

Am I supposed to be adding something in functions.php to tell it where on the form it should appear?

Since this is something that puzzled me too, I did a refactoring of the official example to solve the issue. For anyone who is still interested, here is the gist with the refactored code, and a post with the detailed explanation.

3 Likes

Wierd, @gsarig I stumbled on this post because I was having the same issues. Hoping this would let me set the order of the repeater by dragging it inside the form-builder. But it’s still behaving as mentioned by @tonyman.

Also, When I add a ‘teammember’ it adds 3 instead of 1.

Perhaps try removing the field first, save the form in order to clear it and then use the refactored code that I suggest on my previous post. Save the form again and see what happens. It goes without saying that the old code from the official example should be completely removed.

Ah. I see. This works fine. Thank you :slight_smile: Now what is left are the extra instances of the repeater that are added when I click the add ‘your repeater name’ button. gformAddRepeaterItem() function looks fine though.

OMG i figured this out. I’m running this in development mode with gulp browsersync. This was causing the trigger to fire multiple times! The issue is not with the code…

I’ve been using it for the past two months on a complex form and I can say that, despite its flaws, it does the job. You can use more than one repeaters on the same form and it plays nice with pagination. Unfortunately there are still quite a few bugs, mostly related to field validation and the only workaround for now is some hackish JavaScript.

What worries me is that there doesn’t seem to be any real progress with its development. I don’t know how the competition fares on the matter, but for me the lack of repeater fields could end up being a deal-breaker. If I hadn’t found the solution I posted, I would start looking for a different form plugin despite the fact that I am heavily invested on Gravity Forms and I use it on dozens of sites.

2 Likes

Yes same here. But if this does not speed up I’m looking at formidable forms, they already have repeaters. Can’t think of any reason as to not give this feature priority.

I like this API better.

@gsarig can you please open a support ticket here with the issues you have found, so we can be sure we are addressing them?

https://www.gravityforms.com/open-support-ticket/

Thank you.

1 Like

Hi @chrishajer
I’ve just submitted a ticket with the most important issues that I’ve found so far.

Thank you.

1 Like

Great post @gsarig, thank you for sharing.