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!