Skip to content

PF4-Mapper: conditions within a field-array do not hide the label  #1141

Closed
@steverhoades

Description

@steverhoades

Scope: PF4 mapper

Description
When using a condition to hide an input from within a form-array the label will remain while the input get's hidden. This is due to the fact that the label is handled outside of the rendering of the input. I'm placing this here in case others might have an approach to resolving this (I can't see a clear path).

The only approach I can see would be to do an application of the conditions before a render call, perhaps something like a preRender().

Schema

const schema = {
  fields: [
    {
      "component": "field-array",
      "label": "Select One",
      "name": "SelectOne",
      "fields": [
        {
          "component": "select",
          "label": "Select Option",
          "name": "Option",
          "simpleValue": true,
          "options": [
            {
              "label": "Placeholder1",
              "value": "Placeholder1"
            },
            {
              "label": "Placeholder2",
              "value": "Placeholder2"
            },
          ]
        },
        {
          "component": "text-field",
          "name": "HiddenInput",
          "label": "Hidden Input",
          "condition": {
            when: `Option`,
            is: 'Placeholder1',
            then: {visible: true},
          }
        },
      ]
    } 
  ]
}

Sandbox Example

Metadata

Metadata

Assignees

Labels

PF4PF4 pull requestbugSomething isn't workingreleased

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions