Fields validation

Hi, guys. Is there a way to validate fields in real time with javascript? I have many fields which use reactive/lazy to and this cause some problems such as data disappearing for a short period or deleting some text if put reactive on a rich editor field. What I want to say is that I need to use less the reactive or lazy on the fields. Thank you
2 Replies
Patrick Boivin
Patrick Boivin14mo ago
Hi @dianamujoiu , have you tried extraAlpineAttributes? Something like this, on a given field :
->extraAlpineAttributes(['x-on:blur' => 'customValidator($el)'])
->extraAlpineAttributes(['x-on:blur' => 'customValidator($el)'])
You may be able to integrate with a JS validation library such as https://wangchujiang.com/validator.js/
DianaMujoiu
DianaMujoiu14mo ago
I will try. Thank you for your answer