Support

Account

Home Forums General Issues Grouping large amounts of fields

Solving

Grouping large amounts of fields

  • Hey.

    I expose a front-end post form to my users, where they, amongst other things, can pick a category. Depending on the category (which are 30+ and counting) a set of fields specific for that category will be displayed. I want it to render directly below the category, and preferably inside a HTML sub-fields wrapper.

    Using the regular ACF, this will lead to an excessive list of fields, with repetitive conditional logic applied to them, and no wrapper.

    Repeater Field and Flexible Content Field doesn’t really do what I need. Do anyone have suggestions on how I should approach this?

  • Hi @alexanderwallin

    Can you please provide some screenshots which demonstrate the problem, I’m a bit confused about these points:

    1. I want it to render directly below the category,
    2. with repetitive conditional logic applied to them, and no wrapper.
    3. Repeater Field and Flexible Content Field doesn’t really do what I need

  • Sure thing. I’m going to take them in reverse order. 🙂

    3. Repeater Field and Flexible Content Field doesn’t really do what I need

    I want to group large sections of fields inside one Field Group. The users should not be able to create multiple values for each field.

    2. with repetitive conditional logic applied to them, and no wrapper.

    In lack of a Group Field (or something similar), I can’t wrap all the “Cars” subfields and only set conditional logic on that group, I need to set the logic on each field, which gets quite fiddly, although it’s not the biggest issue.

    I can’t find a way of wrapping a set of fields in a HTML wrapper with the regular ACF.

    1. I want it to render directly below the category

    Category-specific fields needs to appear right below the category field in the form. This is what the form look like (all are ACF fields):

    [Title]
    [Description]
    —————
    [Category]
    (Wrapped in a div:) Category-specific fields: [field 1], [field 2], …
    —————
    …the rest of the form…

    With one Field Group for each category, I could have render two forms on the front-end: the main post form and the category subfields form, but this is not an option. I made the conclusion that in order to keep all fields in the same form, all fields need to be in the same Field Group. Am I wrong? Is there a clean way of including fields from one Field Group in another Field Group’s form?

    UPDATE: I could set 'form' => false when calling acf_form() for all per-category Field Groups. That would render them either at the top bottom of the form, but that’s solvable jQuery-wise. Still prefer spitting out ordered HTML, so if there is a better way, shoot!

    Conditional logic and category

    Another problem is that I can’t set a field to depend on the value of a taxonomy field. Is there an add-on, official or not, to solve this?

    Thanks

  • After some fiddling and testing, there are two things that would make it all super for me, and that’d probably make a good edition to the plugin:

    1. a Group Field — a layout field with conditional logic, like Tab and Message, which nests other fields both logically and in HTML; and
    2. conditional logic with selected taxonomy as a possible options (e.g. show if category is “Cars”)

    Are these ideas useful and doable? Would they be considered to be part of ACF or should I make my own extensions?

  • Hi @alexanderwallin

    Thanks for clarifying. Yes, both of these ideas are doable and I’m sure they will make there way into the core in the near future.

    The conditional logic one will get added sooner as I already have this on the to-do.

    The grouped fields is a tricky one. I have a feeling tha the change in markup may effect some jQuery. Perhaps you can tackle this one first with some jQuery of your own to wrap the fields?

    Thanks
    E

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

The topic ‘Grouping large amounts of fields’ is closed to new replies.