© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
5 replies
ericmp #2

How to make Repeater unique fields name

I have a fields repeater. this fields have a name. the name must be unique. how to do it (,: ?
Repeater::make('fields')
    ->defaultItems(1)
    ->hiddenLabel()
    ->required()
    ->itemLabel(function (array $state): string {
        return $state['name'] ?? '-';
    })
    ->grid()
    ->cloneable()
    ->reorderable()
    ->label(__('Fields'))
    ->collapsible()
    ->addActionLabel(__('Add field'))
    ->schema([
        Forms\Components\TextInput::make('name')
            ->required()
            ->label(__('Name'))
            ->live()
        ,
    ])
,
Repeater::make('fields')
    ->defaultItems(1)
    ->hiddenLabel()
    ->required()
    ->itemLabel(function (array $state): string {
        return $state['name'] ?? '-';
    })
    ->grid()
    ->cloneable()
    ->reorderable()
    ->label(__('Fields'))
    ->collapsible()
    ->addActionLabel(__('Add field'))
    ->schema([
        Forms\Components\TextInput::make('name')
            ->required()
            ->label(__('Name'))
            ->live()
        ,
    ])
,

i tried to use the
->different()
->different()
- https://filamentphp.com/docs/3.x/forms/validation#different
but idk how to make it work since is inisde a repeater 🤔
Screenshot_2023-12-15_at_11.32.38.png
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

dynamic repeater fields names
FilamentFFilament / ❓┊help
17mo ago
How to create really unique Repeater
FilamentFFilament / ❓┊help
3y ago
Repeater unique field
FilamentFFilament / ❓┊help
3y ago
Repeater Fields to TextColumn
FilamentFFilament / ❓┊help
2y ago