formio.js icon indicating copy to clipboard operation
formio.js copied to clipboard

Hidden radio component still shows when conditional is present

Open CoreNetJC opened this issue 6 years ago • 4 comments

Environment

Please provide as many details as you can: A radio component marked as hidden still shows when there is a conditional present. When the conditional is removed, it properly hides the component.

We use an archive process where we simply mark a given component as hidden when we change things around in our forms, but want to maintain a reference to what was there in a previous iteration. Would prefer to keep the conditionals as well for reference and have it honor the hidden checkbox when checked despite having a conditional applied.

  • Hosting type
    • [] Form.io
    • [ x ] Local deployment
      • Version:
  • Formio.js version: 4.10.2
  • Frontend framework: Bootstrap 3
  • Browser: Chrome
  • Browser version: newest

Steps to Reproduce

  1. Create a radio component with yes and no as data points.
  2. Add a conditional
  3. Mark it as hidden

Expected behavior

The component should not show in the form due to the hidden checkbox

Observed behavior

The component will ignore the hidden checkbox when the conditional is present and will still show in the form.

Example

If possible, please provide a screenshot, live example (via JSFiddle or similar), and/or example code to help demonstrate the issue.

For code or form JSON, please enclose in a code block:

// your code here

CoreNetJC avatar Jun 16 '20 05:06 CoreNetJC

I believe this is expected since "conditions" on the component take priority over the hidden checkbox. To achieve what you are looking for, just add a custom CSS class to the component, and then in CSS provide "display: none"

travist avatar Jun 16 '20 20:06 travist

It appears to ignore other things like the validation checkbox as well, so in our case a CSS class won't help. I do appreciate the recommendation though.

It was my understanding that the hidden checkbox would overrule other items and simply remove it completely from the flow of the form.

CoreNetJC avatar Jun 22 '20 06:06 CoreNetJC

Hidden does not override all conditional logic, it is just the default state of the component. If a conditional evaluates to show a component, it will show. If you never want a component to show, mark it as hidden and don't add any conditional logic.

randallknutson avatar Jun 22 '20 15:06 randallknutson

Closing this thread as it is outdated. Please re-open if it is still relevant. Thank you for your contribution!

Tatsiana8 avatar Feb 07 '24 14:02 Tatsiana8