Skip to content

Using callable with disabled(...) prevents saving #15661

Open
@damms005

Description

@damms005

Package

filament/filament

Package Version

latest

Laravel Version

latest

Livewire Version

latest

PHP Version

latest

Problem description

When using callable to evaluate disabled() as shown below, and the callable evaluates to false, the column fails to save to db. I guess same applies to hidden(), too.

Forms\Components\Toggle::make('is_boss')
                    ->disabled(fn($state) => $state)
                    ->required()

Expected behavior

If the callable provided to disable() evaluates to false, the record should be persisted to the database.

Steps to reproduce

  • create a resource
  • for one of the columns of the resource, use a callable for disable() as shown in the snippet below
  • ensure that the callable evaluates to false so that the value is editable from the UI
  • edit the value from the UI
  • observe that when you save, the column reverts back to what is was
Forms\Components\Toggle::make('is_boss')
                    ->disabled(fn($state) => $state)
                    ->required()

Reproduction repository (issue will be closed if this is not valid)

https://github.com/damms005/filament-issue/tree/bug/disabled-columns

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    Status

    Todo

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions