Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Override a value of deinamically shown field #4433

Open
1 task done
dejanbelusic opened this issue Dec 31, 2024 · 0 comments
Open
1 task done

Override a value of deinamically shown field #4433

dejanbelusic opened this issue Dec 31, 2024 · 0 comments
Labels
needs triage Initial label given, to be assigned correct labels and assigned question

Comments

@dejanbelusic
Copy link
Contributor

dejanbelusic commented Dec 31, 2024

Prerequisites

What theme are you using?

mui

What is your question?

Hello,

Is it possible to override a value of dynamically shown field if a condition is met?

I was trying this example.
I want to have one conditional field and change it's value if another field is checked or not. Is that possible to do inside a schema?

{
  "title": "Conditional Field Example",
  "type": "object",
  "properties": {
    "includeField": {
      "type": "boolean",
      "title": "Include additional field?"
    },
    "additionalField": {
      "type": "string",
      "title": "Additional Field"
    }
  },
  "dependencies": {
    "includeField": {
      "oneOf": [
        {
          "properties": {
            "includeField": {
              "const": true
            },
            "additionalField": {
              "type": "string",
              "title": "Additional Field2",
              "default": "test 2"
            }
          }
        },
        {
          "properties": {
            "includeField": {
              "const": false
            },
            "additionalField": {
              "type": "string",
              "title": "Additional Field3",
              "default": "test 3"
            }
          }
        }
      ]
    }
  }
}
@dejanbelusic dejanbelusic added needs triage Initial label given, to be assigned correct labels and assigned question labels Dec 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage Initial label given, to be assigned correct labels and assigned question
Projects
None yet
Development

No branches or pull requests

1 participant