4 Replies Latest reply on Nov 13, 2015 1:06 PM by 1963cja

    Custom calculation script not running after field has data entered


      I have a form that the user enters the Postal Code which is 6 characters with no spaces.  I take the 6 characters enters and create another field which puts it into Postal Code format, but it only seems to work when they have to enter more information which isn't always the case.  Any ideas on how to make it automatically update after the first 6 characters are entered?


      Here is my code:


      var s = this.getField("Postal_Code").valueAsString;

      if (s!="") event.value = s.substring(0,3) + " " + s.substring(s.length-3);

      else event.value = "Postal_Code";