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

fix broken dependsOn functionality #58

Merged
merged 1 commit into from
Oct 30, 2024

Conversation

miagg
Copy link
Contributor

@miagg miagg commented Apr 1, 2024

This will fix javascript error that prevents dependsOn functionality on the latest Laravel Nova version (see attached video)

Example to reproduce

Boolean::make('toggle'),
SimpleRepeatable::make('repeater', [
    // Some fields
])->dependsOn('toggle', function (SimpleRepeatable $field, NovaRequest $request, FormData $formData) {
    $field->show($formData->test);
}),
Screen.Recording.2024-04-01.at.6.21.23.PM.mov

@adampachowicz
Copy link

I have the same problem. Can you @KasparRosin merge this fix?

@AshutoshJha15
Copy link

@miagg Bro, can you check? setValue is not working

@Norgul
Copy link

Norgul commented Jul 12, 2024

Maybe slightly off topic, but can dependsOn function with inner fields? Like this:

SimpleRepeatable::make('Repeat this', 'products', [
    Multiselect::make('Products')->asyncResource(Product::class)->singleSelect(),
    Text::make('Unit')->dependsOn('products', function (BelongsTo $field, NovaRequest $request, FormData $formData) {
        ...
    }),
    ...

Edit: I see the same question on #28, so will direct any further communication there
Edit2: I have created a PR for what I asked for #61

@ndrez-outl1ne ndrez-outl1ne merged commit 2420bc6 into outl1ne:main Oct 30, 2024
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

Successfully merging this pull request may close these issues.

6 participants