Home › Forums › General Issues › Issue with radio field type not saving selection & entering new choice instead › Reply To: Issue with radio field type not saving selection & entering new choice instead
The problem is that when you use the “other” choice to allow custom entries what happens is that ACF compares the submitted values against the existing values. At this point the existing value is an unescaped html value while the submitted value has had the html escaped. The values do not match so ACF thinks it is a new value and then proceeds to save this new escaped value.
This can be overcome by adding an acf/update_value filter (https://www.advancedcustomfields.com/resources/acf-update_value/) with a priority of < 10 so that your filter can run before the built in ACF filter. In this filter you can then correct the submitted value to be correct HTML before ACF makes its comparison. However, you should be very careful doing so because this will allow users to submit HTML which could allow XSS attacks on your site.
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!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.