How to use JQuery-Inputmask to validate email addresses?

3.3k Views Asked by At

I want to validate an email. I know how to do it in python code, but I want to do this using XML, below is my XML field:

name="email" widget="regex_mask" data-inputmask-regex='[a-zA-Z0-9._%-]+@[a-zA-Z0-9-]+\.[a-zA-Z]{2,4}' context="{'gravatar_image': True}"

This is not working on email, I have also used:

widget="regex_mask"  data-inputmask-regex="^\d+$"

On char filed, and it is working fine.

It would not take any character from the keyboard. If anyone knows how to do this... please let me know, I'm waiting for your answer :) Thanks.

1

There are 1 best solutions below

0
Inigo On

JQuery-Inputmask has a built-in email mask extension.

So instead of your data-inputmask-regex attribute, you should be able to just replace it with

data-inputmask-alias="email"