Open webard opened 1 month ago
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)
dependsOn does not work in cojnunction with any field, not only BelongsTo. Just make simple test:
Select::make(__('Country'), 'country')
->options([
'PL' => __('Poland'),
'CZ' => __('Czechia'),
'SK' => __('Slovakia'),
])
->sortable()
->filterable(),
Timezone::make(__('Timezone'), 'timezone')
->rules('required', 'timezone')
->filterable()
->required()
->rules('required')
->default('Europe/Warsaw')
->dependsOn(['country'], function (Timezone $field, NovaRequest $request, FormData $form) {
dump($form->get('country'));
if ($form->get('country') === 'PL') {
$field->setValue('Europe/Warsaw');
} elseif ($form->get('country') === 'CZ') {
$field->setValue('Europe/Prague');
} else {
$field->setValue('Europe/Bratislava');
}
}),
And timezone won't change.
This tests whould failed right now based on above condition: https://github.com/laravel/nova-dusk-suite/blob/c3587c9b582e3b12be1928e630bbb99c1e56a83f/tests/Browser/DependentActionFieldTest.php#L156-L172
We really need a full reproducing repository before we can move forward.
Description:
I have field
Timezone
onUser
resource, anddefault_timezone
onStore
. When user is created, I want to autocomplete Timezone field basing ondefault_timezone
fromStore
. Both, Store and Timezone fields are in "Personal Data" named panel, but without panel it does not work too. Value is not set and dump is not triggered, but request is correctly initiated when store is changed:Response from
/nova-api/users/creation-fields?editing=true&editMode=create&field=timezone&component=timezone.select-field.timezone
:Detailed steps to reproduce the issue on a fresh Nova installation: