FilamentF
Filament3y ago
Dom

Disable a toggle component in a resource if another a certain text input is empty

As title says. I want to disable or enable a toggle component depending on whether the numeric text input is empty or not.
The component i want to disable has 'is_highlighted' in the make function and the component i want to check has ''order'.

This is what i've tried.

 ->afterStateUpdated(function ($value, $state, $formRequest) {
     if (!empty($value)) {
         $formRequest->setComponentProperty('is_highlighted', 'disabled', true);
          return;
     }
     $formRequest->setComponentProperty('is_highlighted', 'disabled', false);
 }),
Was this page helpful?