© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
3 replies
Ali Abbas

How to conditionally set a field as non-required based on the value of another field?

I have a checkbox ('location_type'), and I want to remove the 'required' constraint from a subsequent field ('name') if the checkbox is checked, utilizing the reactive() method. The relevant code snippet is as follows:
Checkbox::make('location_type')->inline()->reactive(),
TextInput::make('name')
->required()
->maxLength(191)
->columnSpan(1),
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

Conditionally display a section, based on another field's value
FilamentFFilament / ❓┊help
2y ago
how to display fields of form based on value of another field?
FilamentFFilament / ❓┊help
2y ago
How to set value to createOptionForm from another field?
FilamentFFilament / ❓┊help
2y ago
How to set default state of a field conditionally on Edit page
FilamentFFilament / ❓┊help
2y ago