Hey John,
It is possible to set conditions to dynamically show or hide accordion items (or other container/elements) based on the user’s selections in a parent field like a Checkbox List.
Since Cornerstone Forms uses client-side logic to toggle visibility, you can achieve this in two ways:
Method 1: Using Custom Attributes (Recommended for Accordion Items/Containers)
The Cornerstone Forms frontend script automatically monitors any DOM element within the form that has the data-input-conditions attribute. You can add this attribute directly to any element—including Accordion Items or Group/Div containers—via Cornerstone’s built-in Custom Attributes settings under the Customize tab:
- Select the respective Accordion Item or container element you want to show/hide.
- In the inspector under Customize > Custom Attributes, add a new attribute:
Method 2: Using the Input Conditions Control
If the container element supports Cornerstone Forms’ Input Conditions controls out of the box, you can enable and configure the conditions directly within the editor:
- Look for the Input Conditions section in the element’s settings panel.
- Enable the toggle and define the rule matching the parent input’s name (e.g.,
form:input set to match the specific discipline value).
Your observation is correct regarding standard Cornerstone Element Conditions: using conditions like {{dc:url:param key="event-discipline"}} relies on server-side rendering, which means they will not react on-the-fly until the page reloads.
The client-side, on-the-fly logic you need is already built into the Cornerstone Forms Javascript engine, and it might work on container elements like Accordion Items when using custom attributes.
Here is how you can set it up:
Why this might work on Accordion Items
The plugin’s Javascript (specifically in cornerstone-forms.js) contains a global selector observer:
bt.attach("[data-input-conditions]", function(r, e) {
let t = r.closest("form");
// ...
let s = gt(t, e), i = r.closest(".cs-form-input-container") || r;
i.style.display = s ? "" : "none";
});
If you add data-input-conditions to an Accordion Item:
- It is not inside a
.cs-form-input-container, so the script defaults to target the Accordion Item element itself (i = r).
- It listens to the form’s
change event on-the-fly.
- It immediately toggles
display: none or display: block on the Accordion Item when checkboxes are ticked/unticked, without reloading the page.
How to apply this to your layout
For each of your age category Accordion Items, configure them as follows:
1. Accordion Item: Возраста (спорт)
- Select this Accordion Item in the editor.
- Go to the Customize tab and locate the Custom Attributes section.
- Add the following attribute:
2. Accordion Item: Возраста (боевое)
- Select this Accordion Item.
- Under Customize > Custom Attributes, add:
3. Accordion Item: Возраста (пляжное)
- Select this Accordion Item.
- Under Customize > Custom Attributes, add:
(Note: Replace "спортивное", "боевое", and "пляжное" with the exact taxonomy term values/slugs sent by your checkboxes if they differ from the labels).