Restrict text field from keying certain characters by user



Dear All,

We have designed dynamic legal forms and created barcodes for the same at the end of page separately. To make user friendly, we need to restrict the form field by keying unwanted characters by the user because the barcode cannot accept certain special characters it shows error.

For example, in name field the user can able to key only alphabets in addition to apostrophe and hyphen. NOT other special characters such as "\[:;<?!~

which is similar to keying alphabetic characters in numeric field.



View Entire Topic



I am trying to restrict the character at position 0 from numeric. That is, a NAME field is not to start with a numeric charater but can have numeric after position0.
I have written this code below in the change event itself of the field, but it doesn seem to work. Could you please suggest as to where i am going wrong? Or any other alternative to restrict numeric characters at position0? Below is the code:

xfa.this.rawValue.charAt(0).event.change = xfa.event.change.replace(/[0-9]/g, "");