Support

Account

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.