© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
1 reply
Jon Mason

validationMessages not working for regex

 TextInput::make('discount_amount')
                ->regex('/^[0-9]+(\.[0-9]{2})$/i') 
                ->validationMessages([
                    'regex' => 'Must include a decimal point and at least one digit before and exactly 2 digits after the decimal point. (e.g. 100.00)'
                ])
                ->prefix('$')
                ->currencyMask(',', '.', 2)
 TextInput::make('discount_amount')
                ->regex('/^[0-9]+(\.[0-9]{2})$/i') 
                ->validationMessages([
                    'regex' => 'Must include a decimal point and at least one digit before and exactly 2 digits after the decimal point. (e.g. 100.00)'
                ])
                ->prefix('$')
                ->currencyMask(',', '.', 2)


The standard validation message is shown, not the one in the validationMessages array.

Also, if this field is
live(onBlur: true)
live(onBlur: true)
should it validate the field when the onBlur event is fired, because that's not happening.
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

`validationMessages` not working via `validateOnly`
FilamentFFilament / ❓┊help
13mo ago
validationMessages not work
FilamentFFilament / ❓┊help
2y ago
validationMessages within createOptionsFrom not working as expected
FilamentFFilament / ❓┊help
12mo ago
Custom ValidationMessages for minDate/maxDate
FilamentFFilament / ❓┊help
2y ago