2 Replies Latest reply on Jun 6, 2008 12:18 PM by MarkWalsh

    Clear the field if there's no user input?

      Hi folks,
      I have a script to place a percentage sign in a form field value that works fine IF you enter a value (see below)

      var percentage = this.getField("Principal_1_Ownership").value;
      var Principal_1_Ownership = this.getField("Principal_1_Ownership");
      if (percentage < 101) { Principal_1_Ownership.value = Principal_1_Ownership.value + "%"; }
      else {
      Principal_1_Ownership.value = Principal_1_Ownership.value * .10 + "%";

      However, it you don't enter a value (maybe you just want to tab through), sometimes it places a

      NaN% in the field, and other times it places a simple %.

      I don't want either; if the user simple tabs through the field, I want it to appear blank.

      Is there a simple method to do this?

      Thank you,