Hello I want to modify a value of a repeating field according to a specific value.
I don’t know whether to use the update_sub_fields function; the problem with this function is that instead of modifying a value according to the line number I want to modify according to a specific value in my table
Thanks for your help
The only way that you can do this would be to loop over the repeater to find the one you’re looking for. Something like this:
if (have_rows('repeater')) {
while (have_rows('repeater')) {
the_row();
if (get_sub_field('sub_field') == 'something') {
update_sub_field('sub_field', 'new_value');
}
}
}
Thank you for your answer that solves part of my problem.
However I have unique values in my acf_form () form with and I want to have a field which allows to insert a unique value and modify a field of the row
if (have_rows('rsvp')) {
while (have_rows('rsvp')) {
the_row();
if (get_sub_field('unique_id') == '5efb792f219a9') {
update_sub_field('confirmation', 'accept');
}
}
}