I have a textfield in Extjs. This textfield can only contain
Digits 0 - 9
Alphabets a-z or A-Z
_
(underscore) and -
(hyphen)I want to prevent the user from entering anything apart from these characters. As such I wish to display an error, something like a red underline along with helptext
to notify the user as to why the error is there.
Kindly advice as to how to go about preventing the user from entering anything apart from the above characters and also displaying the error message.
Use maskRe
property:
An input mask regular expression that will be used to filter keystrokes (character being typed) that do not match. Note: It does not filter characters already in the input.
maskRe: /[A-Za-z0-9\-_]/
Working example: https://fiddle.sencha.com/#fiddle/o4b