Validate data mask
Asked Answered
M

1

6

I have a problem to validate data- mask.

<strike><input type="text" data-mask="a-99999999-9"></strike>

I need you where going "a" only become available the letters " VEJPG ".

if anyone knows how it could do so thanks.

Marseilles answered 30/4, 2015 at 8:30 Comment(3)
<input type="text" data-mask="a-99999999-9">Marseilles
Do you mean using the pattern attribute? <input pattern="a-[VEJPG]+"/>. Your question isn't very clear.Villain
data-mask="a-99999999-9" "a"= abcdef... "9"= 012345... I need you where going "a" only become available the letters " VEJPG "Marseilles
C
2

JQuery Mask plugin doesn't recognize "a" in the mask expression, it supports "A" This will work:

<strike><input type="text" data-mask="A-99999999-9"></strike>

If you want the first letter to only V or E or J or P or G then you have to call the mask constructor in javascript as follow:

$("#idOfTextInput").mask("v-9999999-9",{translation: {'v':{pattern:/[VEJPG]/}}});
Confiscable answered 12/5, 2015 at 14:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.