Operating System and Version: Windows 11 / WSL Ubuntu 20.04
Browser type and version: All
Description:
Trying to influence the readonly attribute of a MultiSelect field with a dependsOn doesn't work.
When adding a dependsOn rule to manipulate the readonly attribute, it seems like it is evaluated on page load and then nothing happens. I do see the requests being sent via XHR to toggle the field, but nothing happens.
Everything works fine with show() and hide().
I'm using the same thing for Select fields with no issues.
Detailed steps to reproduce the issue on a fresh Nova installation:
Create a basic resource
Add this in the resource's fields():
// the column doesn't exist, the "sync_myfield" is intercepted during `Model::saving()` and removed.
Boolean::make('Edit anyway', 'sync_myfield'),
MultiSelect::make('Unlockable field', 'column')
->options(['option1' => 'Option 1', 'option2' => 'Option 2'])
->dependsOn(['sync_myfield'], fn($field, $request, $data) => $field->readonly( ! $data->sync_myfield))
->readonly(),
// This works
MultiSelect::make('Unlockable field', 'column')
->options(['option1' => 'Option 1', 'option2' => 'Option 2'])
->dependsOn(['sync_myfield'], fn($field, $request, $data) => $data->sync_myfield ? $field->show() : $field->hide())
Edit an existing resource, click on the "edit anyway" checkbox: the field doesn't toggle readonly.
Description:
Trying to influence the
readonly
attribute of aMultiSelect
field with adependsOn
doesn't work.When adding a
dependsOn
rule to manipulate thereadonly
attribute, it seems like it is evaluated on page load and then nothing happens. I do see the requests being sent via XHR to toggle the field, but nothing happens.Everything works fine with
show()
andhide()
. I'm using the same thing forSelect
fields with no issues.Detailed steps to reproduce the issue on a fresh Nova installation:
fields()
: