4 Replies Latest reply on Dec 11, 2016 12:36 AM by pdfUser1

    populate other field

    pdfUser1 Level 1

      I made a calculator that calculates the number of posts for a line of fence. It works fine. What I would like to do now is to add four text fields to be populated with the total posts for the particular line. For instance, I'm figuring the North side line has 6 posts, I would like this total to populate into the Line.North text field. Then reset the fields of the calculator but not the Line.North text field it would stay populated.

       

      So now I want to calculate the total posts for the South side line. The line measurement is different than the North side, so this total should populate Line.South text field but not effect Line.North. Basically, if the Line.North text field is populated then the next total will go into Line.South text field and so on for Line.East and Line.West. Can someone help me with the correct javascript? Can this even be done? Please let me know. Thanks.

       

      At the moment, I use this script attached to a check box that does want I want. But, I would like to eliminate the checkbox.

       

      if (event.target.value!="Off")

      {

      this.getField("Line.North").value=this.getField("PostsWIF").value

      }

      else

      {

      this.getField("Line.North").value=""

      }

       

      I hope this explains it clearly, can someone help.

        • 1. Re: populate other field
          try67 MVP & Adobe Community Professional

          You can use something like this:

           

          if (this.getField("Line.North").valueAsString=="") {
              this.getField("Line.North").value = ...; // enter your value here
          } else if (this.getField("Line.South").valueAsString=="") { 
              this.getField("Line.South").value = ...; // enter your value here
          } // etc.
          
          • 2. Re: populate other field
            pdfUser1 Level 1

            Thanks for the response. I just don't understand the "enter your value here" line. Does that mean something like a number? Would this be correct?

            1. if (this.getField("Line.North").valueAsString=="") { 
            2.     this.getField("Line.North").value = 25; // enter your value here 
            3. } else if (this.getField("Line.South").valueAsString=="") {  
            4.     this.getField("Line.South").value = 50; // enter your value here 

             

             

            • 3. Re: populate other field
              try67 MVP & Adobe Community Professional

              A number, a string, the value of another field, etc.

              • 4. Re: populate other field
                pdfUser1 Level 1

                where would I place the script so the fields would automatically populate instead of having to click the checkbox?