Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.

testing input for values between approved alphacharacters

Avatar

Level 2

Hello all,

I have a question about  the script below.

I want to test input in a text field for allowing approved letter groups in a text field. The field works for the approved letters as providing options for entering A+, A, A-, B+,B,B-, C+,C,C-,D+,D,D-,.

But I need to change the code so that the user is limited to entering the following values as pairs:

EX, VG, G, S, NI and na (all of these are to be case-sensitive.

What changes should I make to the change event code?  I've tried separating the values with quotes, but that isn't the solution.

Here is the code on the change event in JavaScript:

if (xfa.event.newText.match (/[^ABCDEIRna\+\-]/))  {

     xfa.event.change ="";

     xfa.host.beep("3");

}

On the exit event I have this code in FormCalc:

if($ eq "EX" or $ eq "VG" or $ eq "G" or $ eq "S" or $ eq "NI" or $ eq "na" or  $ eq null)

then $ = $

else

     xfa.host.messageBox("Please insert a mark of EX, VG, G, S, NI, or use na.","Data Error - Incorrect Mark", 1, 0)

$ = null

endif

Any help would be appreciated.

0 Replies