data-driven-forms / react-forms

React library for rendering forms.
https://data-driven-forms.org/
Apache License 2.0
295 stars 85 forks source link

For component type tabs, the actions props not working #1430

Closed anjalikalsariya closed 8 months ago

anjalikalsariya commented 8 months ago

Here is the schema:

{
  "title": "Custom form",
  "fields": [
    {
      "name": "SCORE_ATB_OUI",
      "label": "test",
      "options": [
        {
          "label": "keine",
          "value": 0
        },
        {
          "label": "1",
          "value": 1
        }
      ],
      "dataType": "integer",
      "component": "select"
    },
    {
      "name": "tabs",
      "fields": [
        {
          "name": "ATB1",
          "title": "Antibiotikum 1",
          "fields": []
        },
        {
          "name": "ATB2",
          "title": "Antibiotikum 2",
          "fields": []
        }
      ],
      "component": "tabs",
      "actions": {
        "label": ["hideTabs", "SCORE_ATB_OUI"]
      }
    }
  ]
}
anjalikalsariya commented 8 months ago

Hello,

Can you help with this I need to disable particular tab based on another field value?

Thanks

rvsia commented 8 months ago

@anjalikalsariya

Hello, this is not possible in any our tab component. You can either create your own custom TAB component supporting this behavior or you can use condition to display/show two different tab fields - one with disabled, one enabled - but that would require some copy-paste schema.

anjalikalsariya commented 8 months ago

Thanks @rvsia.

Okay got it.

Can you please share code example for the display/show tab using condition ?

rvsia commented 8 months ago

@anjalikalsariya Here is a small example https://stackblitz.com/edit/r7ptns-vhblea?file=schema.js

anjalikalsariya commented 8 months ago

Thank you so much @rvsia. This(https://stackblitz.com/edit/r7ptns-vhblea?file=schema.js) is helpful.