I am using the select field to create a list of towns and cities associated with their postal codes. So my initial logic was to have the towns as the label, and the post codes as the value. Fairly straight forward.
However, it appears that the select field does not allow for duplicate values. Where there are several towns with the same postcode, all the towns after the first one are removed from my select list when I update the field. See in the below example, the second 2795 value and its associated label are removed from my select field when I update the field group.
Is there a way to allow for duplicate ‘values’ in a select list, or, a way around this problem?
I actually thought to transpose the town name to be the ‘value’ and use the postcode as the ‘labels’, but then I ran into the problem of my users only seeing the postcodes in the select list when filling out the form (within WordPress dashboard environment).
anywhere you have two array indexes of the same value some of them will be cancelled out.
I’d suggest using values like ‘2759-1’, ‘2795-2’, or something else that will uniquely identify them and then deal with this in your PHP code.
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
2022 was a big year for Advanced Custom Fields, with more capabilities, a new generation of ACF Blocks, a refreshed UI, and a new home. Our year in review post looks at advancements we’ve made and offers a glimpse of the future. https://t.co/HahJUCcyH4