© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
8 replies
WEBMAS

How to hide/show a text field depending on the selected value in the select field?

Hello.

I have a category table. The line contains the name and has_close_data fields.

I have a table of courses. On the course creation page you can select a category and closing date. How to hide and show a field depending on the has_close_data category?

Concept:

Select::make('category_id')
->relationship('category', 'name')
->preload()
->searchable()
>live()
->afterStateUpdated(function (?string $state) {
 // If the selected category_id select field value has_close_data is true, then we do not hide the close_date field; if it is false, then we hide the close_date field.
})
->required(),

DatePicker::make('close_date'),
Select::make('category_id')
->relationship('category', 'name')
->preload()
->searchable()
>live()
->afterStateUpdated(function (?string $state) {
 // If the selected category_id select field value has_close_data is true, then we do not hide the close_date field; if it is false, then we hide the close_date field.
})
->required(),

DatePicker::make('close_date'),
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

Hide a Toggle field depending on Select option
FilamentFFilament / ❓┊help
3y ago
show/hide field depending on data load?
FilamentFFilament / ❓┊help
3y ago
Showing a table below a select field depending on the selected field.
FilamentFFilament / ❓┊help
3y ago