© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
5 replies
Adnan Yalahow

Repeater immediately change field after another field changes

i needed whenever quantity is changed to automatically set the value to remaining quantity as i type.
Forms\Components\Repeater::make('products')->columnSpan('full')
                                    ->schema([
                                        Forms\Components\TextInput::make('product_name')->required()->columnSpan(2),
                                        Forms\Components\TextInput::make('quantity')->required()->numeric()
                                            ->afterStateUpdated(function ($state, callable $set ){          $set('remaining_qty', $state);
                                            }),
                                        Forms\Components\TextInput::make('total_kg')->required()->numeric(),
                                        Forms\Components\Placeholder::make('remaining_qty')
                                            ->content(function (callable $get){
                                                return $get('remaining_qty');
                                            }),
                                        Forms\Components\TextInput::make('total_cbm')->required()->numeric(),
                                        Forms\Components\Select::make('uom')
                                            ->options([
                                                'cartoon' => 'Cartoon',
                                                'box' => 'Box',
                                                'bundle' => 'Bundle',
                                            ])
                                            ->required(),

                                    ])
                                    ->collapsible()->columns(7),
                                // ...
                            ]),
Forms\Components\Repeater::make('products')->columnSpan('full')
                                    ->schema([
                                        Forms\Components\TextInput::make('product_name')->required()->columnSpan(2),
                                        Forms\Components\TextInput::make('quantity')->required()->numeric()
                                            ->afterStateUpdated(function ($state, callable $set ){          $set('remaining_qty', $state);
                                            }),
                                        Forms\Components\TextInput::make('total_kg')->required()->numeric(),
                                        Forms\Components\Placeholder::make('remaining_qty')
                                            ->content(function (callable $get){
                                                return $get('remaining_qty');
                                            }),
                                        Forms\Components\TextInput::make('total_cbm')->required()->numeric(),
                                        Forms\Components\Select::make('uom')
                                            ->options([
                                                'cartoon' => 'Cartoon',
                                                'box' => 'Box',
                                                'bundle' => 'Bundle',
                                            ])
                                            ->required(),

                                    ])
                                    ->collapsible()->columns(7),
                                // ...
                            ]),
Screenshot_2023-08-09_004709.png
Solution
So you will need to make quanity reactive.

Then use the $record, get the $record for the product and it's quanity, and - this quanity from the records quanity.
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Apply changes to field's sibling from Repeater
FilamentFFilament / ❓┊help
2y ago
Change repeater field label based on other field value
FilamentFFilament / ❓┊help
16mo ago
Focus another select after change
FilamentFFilament / ❓┊help
2y ago
Auto-populating a repeater based on another field
FilamentFFilament / ❓┊help
2y ago