Home › Forums › Backend Issues (wp-admin) › Updating the select field choices becomes unchecked › Reply To: Updating the select field choices becomes unchecked
Let me see if I understand what is happening.
You are dynamically populating the values of a select field from the values of the repeater field.
You make a change to the repeater field that changes a selected value and this causes whatever was selected in the select field to become unselected.
If this is the case then there isn’t any way to do what you want using what you have. Since the old value does not exist ACF does not know what to set as selected. The value is missing.
Your option are:
1) Do not remove values that have been previously selected.’
2) Set the value of the select field to the repeater row position instead of the sub field value and then when using the fields on the front of the site look up that position in the repeater to get the value
3) Create a 3rd field in the repeater for a key that will never be changed and use that for the value. Then look up that key in the repeater to use on the front end. This is just like option 2 but it allows you more control to do things like alter the order of the repeater rows without changing values.
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!
© 2023 Advanced Custom Fields.