FilamentF
Filamentβ€’2y ago
Chrysippus

Hide Select Dropdown depends on the Select Dropdown value?

Hello,

I want to hide a specific Select Dropdown something like this using afterStateUpdated() ,is this possible?

any suggestion to make this work with or without using afterStateUpdated?
  Select::make('type')
      ->required()
      ->options([
          'normal' => 'Normal',
          'service' => 'Service',
          'tier' => 'Tier',
      ])
      ->default('normal')
      ->live(onBlur: true)
      ->afterStateUpdated(function (string $operation, $state, Forms\Set $set, Forms\Get $get) {
          if ($state == 'tier'){
              // show tier column
          }
      }),
  Select::make('tier')
      ->required()
      ->options([
          1 => 'Tier 1',
          2 => 'Tier 2',
          3 => 'Tier 3',
      ])
      ->default(1)



TIA πŸ™
Was this page helpful?