Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Adobe Summit 2023 [19th to 23rd March, Las Vegas and Virtual] | Complete AEM Session & Lab list

Allow the use of the "plus" character in a text field.


Level 2

I have a script on the change event that allows only numbers 1 to 100 and the values a,b,c,d,e,r,i,n. I also want to allow the "-" and "+" entries in the field.

The script below works for the entries, with the exception of the "+" character. How do i change the script so that the field allows an entry like A+, B+, etc.?

On change:

if (xfa.this.change!="" && !xfa.event.newText.match(/^[1-9][0-9]?$|^100|^(a|a-|b|b-|c|c-|d|d-|e|e-|r|n|i)$/)){

xfa.event.change ="";"Incorrect entry... Thanks!");


On exit:


Any help would be appreciated!


So I've altered the change script, but it seems less than efficient. It does work, and does restrict the values to the field correctly:

if (xfa.this.change!="" && !xfa.event.newText.match(/^[1-9][0-9]?$|^100|^(a|a\-|a\+|b|b\-|b\+|c|c\-|c\+|d|d\-|d\+|e|e\-|e\+|r|n|i)$/)){

xfa.event.change ="";"Incorrect entry... Thanks!");


But am still looking for a better way, if there is one.

0 Replies