Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

how to set a text field to only allow alpha characters

Avatar

Level 3

How do I set up a text field to only allow alpha characters? Is there a java script for this?

2 Replies

Avatar

Level 7

You can use a validation pattern, but this will not stop anyone from entering a non alpha character.

Avatar

Level 10

Hi,

you can use a regular expression to filter the values during the change event.

This will only allw to enter characters in the range a-z and A-Z.


if (!xfa.event.change.match(/[a-zA-Z]/g)) {


  xfa.event.change = "";


}