Home › Forums › Add-ons › Repeater Field › Automatically create and prepopulate some repeater fields › Reply To: Automatically create and prepopulate some repeater fields
The only way that I’ve found to dynamically add repeater rows is to first target the click action in ACF that triggers it. This may be possible with the new JS API, but I’ve never tried it and I don’t know of any examples.
$('selector to target click').trigger('click');
You do this as many times as you want rows. After this is done you loop over the new rows in the repeater to add values to the sub field.
This is an old example I created IT DOES NOT WORK because it was based on an older version of ACF. But in it there is an example or how to create and populate repeater rows.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.