Expand my Community achievements bar.

Enter Alphabetic Characters Only On TextField

Avatar

Level 4

Hello folks,

I have a TextField object on my form and I want to limit the user to enter alphabetic(A-Z) characters only(no numeric characters) .

I tried to do it using custom pattern, but without any success.

Is it possible to do it using custom pattern anyway? or do I need to write my own validate script for this simple purpose?

Thank you,

Yair Nevet

3 Replies

Avatar

Level 10

You can use a regular expression in the change:Event of the text field

if(xfa.event.newText.match(/[^A-Za-z/]/))
     {
     xfa.event.change = "";
     }

Avatar

Level 4

Thank you,

that mean I can't use custom pattern and I have to write script, right?

Avatar

Level 10

Correct,

patterns cannot be used to disallow digits or other characters in text fields.