Input masking

Hi, guys. I am using text fields and I need to apply validations For example, TextInput::make('name') ->regex('/^[a-zA-Z\s-+.,/?><:;[]{}|`~=_']*$/') ->minLength(2) ->maxLength(50) ->required(), How can I use to validate the field in real time, not only on the save/create event? For example I don't want to let the user to type numbers. I was trying to use input masking but it doesn't work or I didn't know how to use it. If the input masking doesn't work, how can I show the error when the user is typing something wrong?
9 Replies
krekas
krekasβ€’2y ago
Make it reactive
DianaMujoiu
DianaMujoiuOPβ€’2y ago
Ok, and then what should I use?
krekas
krekasβ€’2y ago
it will remove .defer from the field
DianaMujoiu
DianaMujoiuOPβ€’2y ago
I am sorry if I'm asking too much, but can you show me an example? Thank you πŸ˜€
DianaMujoiu
DianaMujoiuOPβ€’2y ago
So I need to use reactive and regex validation like in my exmaple?
krekas
krekasβ€’2y ago
as i said reactive just removes .defer check livewire docs what it means https://laravel-livewire.com/docs/2.x/properties#binding-nested-data
Dennis Koch
Dennis Kochβ€’2y ago
I think you can use ->reactive() combined with Livewires validateOnly()
DianaMujoiu
DianaMujoiuOPβ€’2y ago
ok, thank you, guys
Want results from more Discord servers?
Add your server