Is it somehow possible to set the select value to null if not visible

I am trying to set the select value to null if the field is not visible in the form. What I have so far.
Toggle::make('customize_compounding')->label('Customize Compounding')->live()->columnSpan(['default' => 2]),
    Group::make([
        Select::make('compound_interval')
            ->enum(CompoundInterval::class)
            ->options(CompoundInterval::class)
            ->default(CompoundInterval::OneMonth->value)
            ->selectablePlaceholder(false)
            ->columnSpan(['default' => 2, 'sm' => 1]),
    ])->visible(fn (\Filament\Forms\Get $get): bool => $get('customize_compounding'))

I don't know how to make that work. Someone has an idea?
Was this page helpful?