1 Reply Latest reply on Feb 1, 2013 9:57 AM by try67

    Formula that adds 1 to the prior field over and over again

    kesibmik

      I have a form that requires me to input numbers into the form fields. There are over 700 numbers that need to be inputted into separate fields. The numbers are sequential so if I input “1” in the first field, is there a JavaScript that I can use for the other 699 fields that will add one to the prior field?

        • 1. Re: Formula that adds 1 to the prior field over and over again
          try67 MVP & Adobe Community Professional
          Sure, but if the fields are named in a consistent manner, there's a very simple way of doing it using a loop.
          Let's say the fields are named Field1 to Field700. Field1 is the editable field, and the rest should be calculated.
          You can add this code as the custom validation code of Field1:

           

           

          for (var i=2; i<=700; i++) {

          this.getField("Field"+i).value = event.value ? (1*event.value)+(i-1) : "";

          }