Support

Account

Home Forums Backend Issues (wp-admin) Radio Button Conditional Field not Saving

Solved

Radio Button Conditional Field not Saving

  • Hey all,

    I have a conditional radio button field which has three values.

    – N/A
    – On
    – Off.

    N/A does nothing, it shows no additional fields.
    Yes – Shows a date field and another multi-select field.
    No – Shows a date field and a text field.

    For some reason when I select Yes or No, the additional fields show up and save but when the page refreshes the radio button selection revers back to N/A which is the first field and does not show the information in the back end.

  • What is the name of the radio field? Do you have another field with the same field name? Duplicate field names is the most common reason for odd behavior like this.

  • It was exactly that…

    I am guessing duplicated names mean in the backend, ACF does not know which one to update so causing issues?

    Would it be something for the future for ACF to flag duplicated names?

  • ACF updates both fields, the problem is that if there is a duplicated field on the page that the second field will overwrite the first value. This is not something to do with ACF, this has to do with the way WP stores values in the database.

    I don’t think it’s really possible for ACF to keep track of all fields and let you know when there is a duplicate.

    There are also times when you want duplicates, or at least there is for me. I use the same field name for the same type of field used for the same purpose in different field groups associated with different post types so that I can right code once that will work for the field on all post types and in all templates where I need to use it.

    It’s basically up to us to make sure we don’t use duplicate field names for any field on the same WP object.

  • Ah yeah, that makes sense, I did not think of it from a meta_key/value pair within WP.

    Should really think about my responses before sending them ha.

    Thanks, John as always, such a genius!

Viewing 5 posts - 1 through 5 (of 5 total)

The topic ‘Radio Button Conditional Field not Saving’ is closed to new replies.