F
Filament7mo ago
Daniel

Help: Form Repeater -> Make Values Selectable Only Once

Hi guys! Do you see any way to make Select/Toggle Values across repeater items selectable only once? It's a language select, and currently, a user can select German/English toggle twice and just save. I'm open for solutions. Thank you!
Repeater::make('translations')
->relationship('translations')
->default(function () {
return [
['locale' => 'en'],
['locale' => 'de'],
];
})
->schema([
ToggleButtons::make('locale')
->label('Language')
->options([
'en' => 'English',
'de' => 'German',
])
->default('en')
->required()
->inline()
->afterStateUpdated(fn (callable $get, $set) => self::updateDisabledLocales($get, $set)),
TextInput::make('course_title')
->label('Course Title')
->required()
->placeholder('Course Title'),
Textarea::make('course_excerpt')
->label('Course Excerpt')
->placeholder('The course excerpt is a short description of the course.'),
Textarea::make('course_description')
->label('Course Description')
->placeholder('The course description is a detailed overview of the course.'),
])
->maxItems(2)
->columnSpan('full'),
Repeater::make('translations')
->relationship('translations')
->default(function () {
return [
['locale' => 'en'],
['locale' => 'de'],
];
})
->schema([
ToggleButtons::make('locale')
->label('Language')
->options([
'en' => 'English',
'de' => 'German',
])
->default('en')
->required()
->inline()
->afterStateUpdated(fn (callable $get, $set) => self::updateDisabledLocales($get, $set)),
TextInput::make('course_title')
->label('Course Title')
->required()
->placeholder('Course Title'),
Textarea::make('course_excerpt')
->label('Course Excerpt')
->placeholder('The course excerpt is a short description of the course.'),
Textarea::make('course_description')
->label('Course Description')
->placeholder('The course description is a detailed overview of the course.'),
])
->maxItems(2)
->columnSpan('full'),
2 Replies
Want results from more Discord servers?
Add your server