Home Forums General Issues Radio groups should not have an option checked by default


Radio groups should not have an option checked by default

  • I’m setting up fields for users and I have a radio group with ‘Yes’ and ‘No’ as options for a ‘Receive Emails’ option.

    I don’t want a true/false because I want people to have to make a choice, but the problem is that the first option is checked by default when I load a profile page.

    In any case, I don’t have anything entered in the ‘Default Value’ field and that should be honoured on the “front end”.

    I’m using ACF Pro.

  • Hi @squarestarmedia,

    Thanks for the post.

    I have just tried to replicate this on my end but I am afraid I was not successful.

    I would like to point out that you can still make use of a true/false field or a checkbox field and set this to “Required” and the users will be prompted to make a selection before the post is saved.

  • Hi @James

    I’m not sure what you mean about not being able to replicate the issue. If you add a radio field, the first option will be checked – that’s the problem.

    The true/false solution doesn’t work because if you make it required it does not validate if left unchecked. Even if it did validate, it would be unreliable because it does not force the user to make a choice – they could leave it unchecked by accident.

    Using checkboxes instead of radios does not work because the user can check both ‘yes’ and ‘no’.

    There is one, elegant solution for the problem: Only make one of the radios checked if it explicitly set as the default. There is absolutely no reason to have the first one checked otherwise.

  • Hi @squarestarmedia

    A Radio button is used to let a user select ONE of a limited number of choices. So, one of them will always be selected. If you want to force your user to make a choice, you can use a select field type and then set both “Required?” and “Allow Null?” options to “Yes”. I’ve attached a screenshot for your reference.

    I hope this helps.

  • @James

    I feel somewhat condescended to (I know how selects work); I hope that wasn’t your intention.

    Anyway, I just realised that this topic I opened is over a year old. Last August I filed a bug report, as nothing happened with this topic. That report is here: .

    I think it would be better to continue this over there, as there has been more discussion and most of the points I was going to make here, I have already made there.

  • Hi @squarestarmedia

    I’m really sorry that my answer makes you feel that way. I just want to make sure that my answer can be followed easily, even for a new user.

    As John said before, most of the time users want one of radio buttons to be selected because that’s how it supposed to be. It’s not a rule, but it’s just how it works most of the time. If you think this is not how it supposed to be, you can always open a new ticket on the following link to fill a bug report or feature request:

    In the meantime, you I believe you can use jQuery to modify the “checked” attribute (this would be for advanced users). You can use the acf/input/admin_head hook to add the script. In that hook, you can check if the field has a value or not and then remove the “checked” attribute if it doesn’t have a value yet.

    I hope this makes sense 🙂

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

The topic ‘Radio groups should not have an option checked by default’ is closed to new replies.