4 Replies Latest reply on Jul 1, 2011 7:12 PM by gkaiseril

    Validation loop




      Have this code to check if the user input from a prompt is 6digits long


      At the moment , if the user enters 3 characters for example, the script stops.


      Is there any way to keep prompting the user for 6 digit input, and will only continue with rest of code until they do so. They can also press cancel to quit out of the entire script.


      // Define a regular expression for 16 digits
      var criteria = /^\d{6}$/;
          if (!criteria.test(reply)) {
              // Alert the user something's wrong
              app.alert("Customer number must be 6 digits. Please try again", 6);
              return false;