Skip to content

The point of adding class fb-cl-hide-element? #384

@studio1gmbh-pimcore

Description

@studio1gmbh-pimcore

Hi, in the docs it is mentioned to add the css class fb-cl-hide-element, to make conditional logic work. It seems formbuilder is using this class to set the initial visibility of certain fields, that should be hidden by conditional logic.

- Add the `fb-cl-hide-element` class with a `display:none;` property to your project style

foreach ($this->getFields() as $conditionFieldName) {
$data[$conditionFieldName] = $state === $toggleState ? 'fb-cl-hide-element' : '';
}

So when setting up a condition like this:

image
image

The fb-cl-hide-element is added to the required form field as expected but then, it never gets removed. Since the "Toggle Visibility" feature in general works by adding inline style style="display:none" in the DOM.

So users now have two options:

  1. Don't add the class fb-cl-hide-element to the project styles, then "Toggle Visibility" feature will work
  2. Use "Toggle Class" in combination with fb-cl-hide-element to hide form fields

Is it just me or are the docs a bit misleading on this topic?

Thanks for feedback in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions