FilamentF
Filament17mo ago
akki-ca

Unsaved alerts show always pops up even if no changes made - `mask(RawJs::make('$money($input)'))`

Package
Panel builder

Package Version
v3.2.63

How can we help you?
Issue Description
When using RawJs::make('$money($input)') with a field that has unsavedChangesAlerts(), the alert Changes you made may not be saved. is always displayed when navigating away from the page, even if no changes were made.

Code Example
Forms\Components\TextInput::make('premium')
    ->nullable()
    ->numeric()
    ->inputMode('decimal')
    ->prefix(__('$'))
    ->rules([
        'max:999999.99',
    ])
    ->mask(RawJs::make('$money($input)'))
    ->stripCharacters(','),


Question
Is there a way to prevent Filament from showing the alert if no changes have been made?
354761699-6078b1cf-a74c-4991-8b30-88d5763599e5.png
Solution
I guess mask modifies the state on the client side and therefore it think it’s unsaved. Not sure whether we can solve this without increasing the complexity but you can still try submitting an issue.
Was this page helpful?