© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
7 replies
agampradhana

TextInput $set doesn't work on Mask

TextInput::make('dp')
    ->label('DP')
    ->reactive()
    ->afterStateUpdated(function ($state, callable $get, callable $set, $component) {
        $total = 0;
        foreach ($get('invoice_items') as $item) {
            $total += ($item['unit_price'] * $item['qty']);
        }

        $due = $total - $state;
        $set('due_payment', $due);
    })
    ->numeric()
    ->mask(
        fn (TextInput\Mask $mask) => $mask
            ->patternBlocks([
                'money' => fn (Mask $mask) => $mask
                    ->numeric()
                    ->thousandsSeparator(',')
                    ->decimalSeparator('.'),
            ])
            ->pattern('Rp money'),
    )
    ->required(),
TextInput::make('due_payment')
    ->label('Sisa Pembayaran')
    ->disabled()
    ->numeric()
    ->mask(
        fn (TextInput\Mask $mask) => $mask
            ->patternBlocks([
                'money' => fn (Mask $mask) => $mask
                    ->numeric()
                    ->thousandsSeparator(',')
                    ->decimalSeparator('.'),
            ])
            ->pattern('Rp money'),
    ),
TextInput::make('dp')
    ->label('DP')
    ->reactive()
    ->afterStateUpdated(function ($state, callable $get, callable $set, $component) {
        $total = 0;
        foreach ($get('invoice_items') as $item) {
            $total += ($item['unit_price'] * $item['qty']);
        }

        $due = $total - $state;
        $set('due_payment', $due);
    })
    ->numeric()
    ->mask(
        fn (TextInput\Mask $mask) => $mask
            ->patternBlocks([
                'money' => fn (Mask $mask) => $mask
                    ->numeric()
                    ->thousandsSeparator(',')
                    ->decimalSeparator('.'),
            ])
            ->pattern('Rp money'),
    )
    ->required(),
TextInput::make('due_payment')
    ->label('Sisa Pembayaran')
    ->disabled()
    ->numeric()
    ->mask(
        fn (TextInput\Mask $mask) => $mask
            ->patternBlocks([
                'money' => fn (Mask $mask) => $mask
                    ->numeric()
                    ->thousandsSeparator(',')
                    ->decimalSeparator('.'),
            ])
            ->pattern('Rp money'),
    ),

Its doesn't set the due_payment, but when i remove the the Mask on due_payment its work
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Textinput mask class doesn't exist. Other way to implement money masking?
FilamentFFilament / ❓┊help
3y ago
TextInput Autocomplete doesn't works
FilamentFFilament / ❓┊help
16mo ago
How to use mask in TextInput
FilamentFFilament / ❓┊help
3y ago
How to validate a Mask TextInput?
FilamentFFilament / ❓┊help
3y ago