acf-dynamic-ajax-select-example icon indicating copy to clipboard operation
acf-dynamic-ajax-select-example copied to clipboard

Use within repeater

Open solech1 opened this issue 7 years ago • 3 comments

Many thanks for this script! Any one able to help with adapting this to work exactly as is, but in a repeater field. So, in the "Post" post type, you can have both the state select field and the city select field in a sub-field then repeated.

Any help very much appreciated!

solech1 avatar Mar 02 '18 15:03 solech1

When working with repeater fields, what you need to do is figure out what row you working on and then adjust base on that.

For example, get the row of the current field var $row = e.$el.closest('.acf-row'); the you need to find the other field in the same row. var $select = $row.find('[data-key="field_5793770922131"] select');

Hube2 avatar Mar 04 '18 14:03 Hube2

Awesome, thanks!

solech1 avatar Mar 05 '18 11:03 solech1

Hi @Hube2, sorry to resurrect this thread. Any idea why this wouldn't save? The solution above works for populating the select within the repeater, but wouldn't save. Many thanks!

solech1 avatar Mar 13 '18 17:03 solech1