Dependant Field not working on Action Field #6679
Replies: 3 comments
-
Unable to reproduce the issue, please provide full reproducing repository based on fresh installation as suggested in the bug report template (or you can refer to https://github.com/nova-issues for example) |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Beta Was this translation helpful? Give feedback.
0 replies
-
<?php
namespace App\Nova\Actions;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Support\Collection;
use Laravel\Nova\Actions\Action;
use Laravel\Nova\Actions\ActionResponse;
use Laravel\Nova\Fields\ActionFields;
use Laravel\Nova\Fields\Boolean;
use Laravel\Nova\Fields\FormData;
use Laravel\Nova\Fields\Text;
use Laravel\Nova\Http\Requests\NovaRequest;
class TestAction extends Action
{
use InteractsWithQueue;
use Queueable;
/**
* Perform the action on the given models.
*
* @return mixed
*/
public function handle(ActionFields $fields, Collection $models)
{
//
}
/**
* Get the fields available on the action.
*
* @return array<int, \Laravel\Nova\Fields\Field>
*/
public function fields(NovaRequest $request): array
{
return [
Boolean::make('Boolean', 'boolean'),
Text::make('Text', 'text')
->hide()
->dependsOn('boolean', function (Text $field, NovaRequest $request, FormData $formData) {
- if ($formData->boolean) $field->show();
+ if ($formData->boolean('boolean')) $field->show();
}),
];
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
laravelwebdev
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Description:
Dependant Field not working on Action Field
Detailed steps to reproduce the issue on a fresh Nova installation:
Create Action with action field.
Create dependant field on action filed depend on another field (eg dependant hide, default, setvalue, option.
Beta Was this translation helpful? Give feedback.
All reactions