6 Replies Latest reply on Feb 19, 2013 11:54 AM by yeungyam

    Reset field to " " when opening file

    yeungyam Level 1

      I have 2 numerical field, one that is called "ID" and the other is called "Unique".

      When "Unique" is filled out, I want to have "ID" retranscribe the same number. So I put the following code in the calculate:

       

      (function () {

       

          var f_source = getField("Unique");

          var result;

       

          if (event.source && event.source === f_source) {

              result = +f_source.value ;

              event.value = result == 0 ? "" : util.printf("%.0f", result);

          }

       

      })();

      This works fine.

       

      What I want is that when a user re-open this file that the field "ID" resests to nothing (" "). I tried putting this code in the Document JS

       

      this.getField("ID").value == " ";

       

      but it is not working and the number is still there in the "ID" field when I re-open the file.