2 Replies Latest reply on Sep 17, 2012 1:17 PM by ihennessey

    Field value + 1

    ihennessey

      How do I script so that a field is the value of the previous field + 1? 

       

      If the first field is named "field1" and has an input value of 1, I want the next field named "field2" to show a value of 2.  Then, "field3" would show a value of 3, and so on.

       

      If I wanted to start "field1" with an input value of 60, then the next field would calculate a value of 61. 

       

      I imagine this is pretty simple, but I don't know how to do it.

        • 1. Re: Field value + 1
          George_Johnson MVP & Adobe Community Professional

          If you want to use the simplified field notation option on the Calculate tab of the field, for field2 you'd just enter:

           

          field1 + 1

           

          and for field 3:

           

          field2 + 1

           

          Make sure the field calculation order is correct when you're done setting everything up.

           

           

          The equivalent JavaScript would be:

           

          // Get the value of field1, as a number, add one to it, and set this field value to the result

          event.value = +getField("field1").value + 1;

          1 person found this helpful
          • 2. Re: Field value + 1
            ihennessey Level 1

            Thank you George.  The simplified field notation option worked perfectly.