Support

Account

Home Forums Add-ons Flexible Content Field Allow checkbox to be checked in one flexible content field only

Solving

Allow checkbox to be checked in one flexible content field only

  • Hi,

    To demonstrate what I need help with, here is the scenario:

    I have a flexible content field of “Subscriptions” (with various sub fields). In the admin I want the user to be able to create multiple subscriptions but make only one “Most Popular”. I have done this so far by adding a checkbox sub field to the flexible content field for “Most Popular”. But obviously this shows on each flexible content block added in the admin. So the user could theoretically check the box on all of them, which defeats the purpose of having a most popular sub.

    Can anyone think of a way to limit that checkbox to just one instance? So the user can only select one of the flexible content blocks as Most Popular?

    Thanks for any advice.

  • Hi @xav,

    Thanks for the post.

    As a workaround, I would suggest you switch to a Repeater field.

    Here you will only need to create a Repeater and a sub field called “Most Popular”. You can then limit this sub field to one row. Afterwards you can then nest another repeater field containing the rest of the sub fields.

    For more info on nesting Repeaters, you can look at this resource: https://www.advancedcustomfields.com/resources/working-with-nested-repeaters/

  • Thanks James. As ever with ACF, it’s simply a case of thinking about the issue a slightly different way and you can nearly always find a solution.

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

The topic ‘Allow checkbox to be checked in one flexible content field only’ is closed to new replies.