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 dynamically shown field #4433

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

Override a value of dynamically shown field #4433

dejanbelusic opened this issue Dec 31, 2024 · 1 comment

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
@heath-freenome heath-freenome changed the title Override a value of deinamically shown field Override a value of dynamically shown field Jan 10, 2025
@heath-freenome
Copy link
Member

@dejanbelusic Once there is a value for the field in the formData then it won't change

@heath-freenome heath-freenome added awaiting response and removed needs triage Initial label given, to be assigned correct labels and assigned labels Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants