© 2026 Hedgehog Software, LLC

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

Text Input Column Validation Not Working

Hi,

I am trying to add a rule (validation check ) to the date text input column rendered in table builder but for some reason it is not working
also is there any way i can access the record in the function because unable to do that as well; it gives the input state

Code:
TextInputColumn::make('deadline')
                    ->type('date')
                    ->rules([
                        fn ($record, $component) => function ($attributes, $value, $fail) use ($record) {
                            if ($value < now()->format('Y-m-d')) {
                                $fail('Closing date must be greater than or equal to ' . now()->format('Y-m-d'));
                            } elseif ($value < $record->deadline?->format('Y-m-d')) {
                                $fail("Closing date must be greater than or equal to last saved date ({$record->deadline->format('Y-m-d')})");
                            }
                        },
                        'nullable'], )
                    ->getStateUsing(fn ($record) => $record->deadline?->format('Y-m-d')),
TextInputColumn::make('deadline')
                    ->type('date')
                    ->rules([
                        fn ($record, $component) => function ($attributes, $value, $fail) use ($record) {
                            if ($value < now()->format('Y-m-d')) {
                                $fail('Closing date must be greater than or equal to ' . now()->format('Y-m-d'));
                            } elseif ($value < $record->deadline?->format('Y-m-d')) {
                                $fail("Closing date must be greater than or equal to last saved date ({$record->deadline->format('Y-m-d')})");
                            }
                        },
                        'nullable'], )
                    ->getStateUsing(fn ($record) => $record->deadline?->format('Y-m-d')),
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

Text Input Column Notification
FilamentFFilament / ❓┊help
3y ago
Text Input Column Update hasMany relation column
FilamentFFilament / ❓┊help
2y ago
Using text input column inside a Infolist?
FilamentFFilament / ❓┊help
15mo ago
regex format lowercase validation on Spatie Tags Input not working on input
FilamentFFilament / ❓┊help
2y ago