© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
4 replies
vahnmarty

How to validate a Mask TextInput?

Currently using this:

TextInput::make('mobile_phone')
  ->label('Mobile Phone')
  ->required()
  ->mask(fn (Mask $mask) => $mask->pattern('(000) 000-0000'))
  ->tel()
  ->telRegex('/^[+]*[(]{0,1}[0-9]{1,4}[)]{0,1}[-\s\.\/0-9]*$/'),
TextInput::make('mobile_phone')
  ->label('Mobile Phone')
  ->required()
  ->mask(fn (Mask $mask) => $mask->pattern('(000) 000-0000'))
  ->tel()
  ->telRegex('/^[+]*[(]{0,1}[0-9]{1,4}[)]{0,1}[-\s\.\/0-9]*$/'),


What I want is that if I hit submit, the error should display "The phone number is not valid. Please enter a valid phone number".
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

How to use mask in TextInput
FilamentFFilament / ❓┊help
3y ago
Textinput validate convert int to string
FilamentFFilament / ❓┊help
12mo ago
TextInput does not add mask to field
FilamentFFilament / ❓┊help
3y ago
Mask TextInput to enter an IP address
FilamentFFilament / ❓┊help
3y ago