Skip to content

Disable select field based on value of another select field #1502

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

Open
ecdeaver opened this issue Apr 9, 2025 · 1 comment
Open

Disable select field based on value of another select field #1502

ecdeaver opened this issue Apr 9, 2025 · 1 comment

Comments

@ecdeaver
Copy link

ecdeaver commented Apr 9, 2025

I'm working with a cascading select situation like this https://www.data-driven-forms.org/examples/cascading-select#heading-cascadingselect and I need to disable the second select field based on the first field value.
Is this possible to disable the field or remove it entirely?

@Hyperkid123
Copy link
Member

Hello @ecdeaver. You can fully remove the field by using the condition.

You can also use resolveProps to mutate your props. However, you might have to change the subscription of your form to ensure the field is recalculated when other fields change.

You can check this example: https://stackblitz.com/edit/vitejs-vite-sz78hsjb?file=src%2FApp.tsx
If you type A (case sensitive), the second select component will be disabled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants