© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
54 replies
gigiloouu

make repeater validation

I have Repeater where i can add many blogs. this blogs has amount. this blogs amount sum should not be more then
sum amount
sum amount
. I want to make validation if first brand amount is 500 and second brand amount i wrote 300 and
sum amount
sum amount
=== 600 second brand amount should have erorr that max value is 100. there is my code:
php 
Repeater::make('purchaseBrands')
                    ->relationship()
                    ->schema([
                        Select::make('brand_id')
                            ->label('Brand')
                            ->relationship('brand', 'name', function (Builder $query, Get $get) {
                                if($get('../../supplier_id') === null) {
                                    return $query;
                                }
                                $brandIds = Supplier::find($get('../../supplier_id'))->brand_id;
                                $query->whereIn('id', $brandIds);
                            })
                            ->searchable()
                            ->disableOptionsWhenSelectedInSiblingRepeaterItems()
                    ->required()
                            ->preload()
                            ->createOptionForm([
                                TextInput::make('name')
                                    ->required()
                                    ->label('New Brand'),
                                TextInput::make('brand_amount')
                                    ->numeric()
                                    ->required()
                            ]),
                        TextInput::make('amount')->required()
                            ->required()
                            ->numeric()
                            ->live()
                            ->maxValue()
                          
                    ])
                    ->columns(2)
                    ->addActionLabel('add blog')
                    ->collapsible(),
php 
Repeater::make('purchaseBrands')
                    ->relationship()
                    ->schema([
                        Select::make('brand_id')
                            ->label('Brand')
                            ->relationship('brand', 'name', function (Builder $query, Get $get) {
                                if($get('../../supplier_id') === null) {
                                    return $query;
                                }
                                $brandIds = Supplier::find($get('../../supplier_id'))->brand_id;
                                $query->whereIn('id', $brandIds);
                            })
                            ->searchable()
                            ->disableOptionsWhenSelectedInSiblingRepeaterItems()
                    ->required()
                            ->preload()
                            ->createOptionForm([
                                TextInput::make('name')
                                    ->required()
                                    ->label('New Brand'),
                                TextInput::make('brand_amount')
                                    ->numeric()
                                    ->required()
                            ]),
                        TextInput::make('amount')->required()
                            ->required()
                            ->numeric()
                            ->live()
                            ->maxValue()
                          
                    ])
                    ->columns(2)
                    ->addActionLabel('add blog')
                    ->collapsible(),
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
Next page

Similar Threads

Form Repeater Validation
FilamentFFilament / ❓┊help
12mo ago
Custom repeater validation
FilamentFFilament / ❓┊help
3y ago
Make hidden repeater
FilamentFFilament / ❓┊help
2y ago
Validation in the Repeater field
FilamentFFilament / ❓┊help
2y ago