Β© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filamentβ€’2y agoβ€’
1 reply
Alexandre

Conditional validation on field in a repeater

Hi all,
I have some difficulties to run validation on fields in repeater fields...
So, let me explain, my repeater is a "product".
This product contains product-related fields (so far, so good).
In this product, I want conditional fields. For example, we have a "key number" field which is required by default.
However, this field should no longer be required if the user has checked the "lost card" field.

Here are the fields concerned in the repeater:

Checkbox::make('no_card')
    ->label(...)
    ->nullable()
    ->live()
    ->columnSpanFull(),
Checkbox::make('no_card')
    ->label(...)
    ->nullable()
    ->live()
    ->columnSpanFull(),


And the second field :

TextInput::make('key_number')
   ->label(...)
    ->prefixIcon('heroicon-m-hashtag')
   ->requiredWithout('no_card'),
TextInput::make('key_number')
   ->label(...)
    ->prefixIcon('heroicon-m-hashtag')
   ->requiredWithout('no_card'),


When I submit the form, it's like the validation passed even if the checkbox is not checked.
I tried also with requiredIf like that :

->requiredIf('no_card', false)
->requiredIf('no_card', false)


Did I miss something to use requiredWithout validation rule with a checkbox?
Because with a textInput it's work...

Thanks πŸ™‚
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

Validation in the Repeater field
FilamentFFilament / β“β”Šhelp
2y ago
Validation of field inside a repeater.
FilamentFFilament / β“β”Šhelp
3y ago
Update relationship on a conditional field
FilamentFFilament / β“β”Šhelp
2y ago
Repeater requiredIf validation from the field outside of repeater
FilamentFFilament / β“β”Šhelp
2y ago