Support

Account

Home Forums General Issues Default value not working.

Solved

Default value not working.

  • Using “0” (Zero) as the default value on a radio button does not seem to work. It just selects the first radio button instead.
    The alternatives I have set up is:

    1 : Yes
    0 : No
  • Hi @KimH,

    Hmm, I just tried a test and it seems to be working fine. 0/No is selected and when I look at the source in firebug, that input has checked=""checked"" as an attribute. I copy and pasted your code block above into a radio field.

    1 : Yes
    0 : No

    Is it possible some other javascript on the page is selecting the first one? Are you sure what you have above is what’s in the choices field. Looks like you already know this but the spaces around the colons are important.

  • I forgot to mention that the radio button is inside a flexible content field, and it looks like the problem is related to this field. It works fine inside a repeater field and on its own. Everything other then “0” seems to work just fine.

  • Hi @KimH

    Thanks for the extra info. I can confirm I am experiencing the same issue and will take a look at it shortly.

    Thanks
    E

  • Hi @KimH

    Thanks again for the bug report. I found the issue was related to ACF ignoring ‘0’ as a default value.

    I have fixed the bug and will push an update to the flexible content field soon.

    Cheers
    E

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

The topic ‘Default value not working.’ is closed to new replies.