2 Replies Latest reply on Oct 16, 2014 6:37 AM by NellievD

    How can I limit the entry options to specific alphabet characters or the numbers 1 to 100 in a text field?

    NellievD

      I've written a script on the change event in Adobe Livecycle Designer ES4 on the change* event which is supposed to do the following:

       

      Allow the user to enter any of the following values, but only ONE option is to be entered:

       

      Any numeric value from 1 to 100 (the field is limited to 3 characters)

      OR

      the entry of the value "na"

      OR

      the entry of the value "r"

      OR

      the entry of the value "i"

       

      Here is the script:

      // Test input in real time. Only allow approved grades, i, i, na

      if (xfa.event.change!="" && !xfa.event.newText.match(/^[0-9]+?$|^(na?)?$|^(r)?$|^(i)?$/))  {

           xfa.event.change ="";

           xfa.host.messageBox("Oops, incorrect entry, Please correct your input. Thank you.");

           }

       

      On the exit event I've set the script to automatically uppercase the characters. This works

       

      Two problems:

      1. I can't restrict the numbers to be between 1 and 100.

      2. I can't restrict the entry of "na". The field still accepts "n" which I don't want.

       

      Is there a way to correct these two issues?  Thanks!