1 Reply Latest reply on Feb 19, 2015 1:33 AM by try67

    Text field not updating ?

    BSisson Level 1

      I have a very simple script that was almost lifted from this forum.

       

      The only changes I made were to make in generic so I could push it up to the document script level and call the same script for multiple buttons.

       

      I have two input text boxes  (Section+"NewDefect" and Section+"NewDefectExport")

      They get put into textVal, exportVal and stuffed into the list called (Section+"Issues") when a button is pushed

      This works fine....  It should as it was lifted from this forum

       

      My Issue.... I want to clear/reset/blank the input text fields when I am done....

       

      I have tried textVal   = null, textVal   = " ", textVal.value   = null

      getting the pointer again and setting it to " " ie :    var rawtextVal   = this.getField(Section+"NewDefect"); rawtextVal = " "

       

      Why can't I blank/clear those text fields?

       

      -------------------------------------------------------------------

      function add_btn(Section)

      {

          var textVal   = this.getField(Section+"NewDefect").value; 

          var exportVal = this.getField(Section+"NewDefectExport").value;

          var listFld   = this.getField(Section+"Issues");

          if (textVal)

          {

              listFld.insertItemAt(textVal, exportVal, 0);   // Everything works GREAT to here...

          }

          textVal     = " ";

          exportVal = " ";        // these seem to be ignored no matter what I do. a println shows they are being executed

      }

      ------------------------------------------------------------------------

        • 1. Re: Text field not updating ?
          try67 MVP & Adobe Community Professional

          To change the value of a field you have to access it directly. Your variables are just holding the value of the field, they're not a reference to it.

           

          You can change the value of a field like this:

          this.getField("Field name").value = "new value;

           

          Or like this:

          var f = this.getField("Field name");

          f.value = "new value";

           

          But not like this:

          var v = this.getField("Field name").value;

          v = "new value";