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

Nested Dependencies #35

Open
DMeganoski opened this issue Jun 4, 2023 · 3 comments
Open

Nested Dependencies #35

DMeganoski opened this issue Jun 4, 2023 · 3 comments

Comments

@DMeganoski
Copy link

I am trying to build a somewhat complex form, which has several dependency containers.

Let's use the examples 'provider' and 'service'. Let's say that each provider has it's own list of services. This is easy to achieve with this package.

The problem is if I want to add a third field that depends on the value of the service selected.

If I use ->dependsOn('service', 'value') this does not seem to pick up the value and does not show the container when it should.

Is there some prefix I need to add to 'service' since it's inside a dependency container?

Any suggestions are much appreciated.

@boris-shakhverdyan
Copy link

boris-shakhverdyan commented Feb 16, 2024

Do you solve it?

@DMeganoski
Copy link
Author

DMeganoski commented Feb 16, 2024

@boris-shakhverdyan I instead leveraged the default 'dependsOn' function.

Instead of hiding the field in some cases, the field is always there, but inside the 'dependsOn' callback I am using $field->options($newOptions) to set the available items when another field changes.
image

@boris-shakhverdyan
Copy link

@boris-shakhverdyan I instead leveraged the default 'dependsOn' function.

Instead of hiding the field in some cases, the field is always there, but inside the 'dependsOn' callback I am using $field->options($newOptions) to set the available items when another field changes.
image

DependencyContainer::make([
Text::make("test")->dependsOn(["info"], function($field, $request, $formdata) {
//This function not run
}
])->dependsOnNotEmpty("key2")

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