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.
You can restrict user input by modifying xfa.event.change during the change event.
To remove the characters you mention, try this script:
xfa.event.change = xfa.event.change.replace(/[\"\\[:;<?!~]/g, "");
Note that most often xfa.event.change is a single character when the user is typing, but could be an entire string if the user pastes into the field.
This script handles both cases.
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, "");