4 Replies Latest reply on Jan 8, 2018 6:32 AM by try67

    Lock Fields on Validation?

    johnm44931462 Level 1

      I want to have 2 text fields lock but only after a correct validation of proper initials from an individual. I have a script to lock fields and s script to validate. How do I put the two together?

       

      Validate:

      event.rc = true;

      if (event.value != "" && event.value != "AAAA" && event.value != "BBBB")

      {

          app.alert("The entered value needs to be either 'AAAA' or 'BBBB'!");

          event.rc = false;

      }

       

      Lock:

      var fieldsToLock = ["TimeField309", "TimeField317"];

      for (var i in fieldsToLock) this.getField(fieldsToLock[i])

       

      How do I put these 2 together for the proper result I'm looking for?