1 Reply Latest reply on Aug 27, 2010 12:19 PM by George_Johnson

    Two fields, two scripts. User can enter data into field 1 or 2

    luke.n.n

      Hi all,

       

      New here, and to acrobat forms, so please bear with me!

       

      What I'm trying to achieve is a form that calculates total invoice value, based on a total number of hours worked, and a rate. The user fills in the total hours, but then the problem is that some people know their fixed rate, and others have a changing rate. Those with a changing rate simply know the amount they are invoicing for. What I'd like, is a way for the TotalInvoice value to be calculated by Rate*TotalHours when the user enters a value into the Rate field... OR ... for Rate to be calculated by TotalInvoice/TotalHours when the user enters a value into the TotalInvoice field.

       

      I can make it go one way or the other (so the script is only in TotalInvoice field or the Rate field), but I can't manage to get it to go both ways. Is this possible?

       

      To summarise: User can enter manually into Field1 and value of Field2 is calculated, or user can enter manually into Field2 and Field1 is calculated.

       

      Thanks!

        • 1. Re: Two fields, two scripts. User can enter data into field 1 or 2
          George_Johnson MVP & Adobe Community Professional

          What you propose can be difficult, becuase you're describing a circular reference between the two fields. When the 1st value changes, you want the 2nd value to be calculated based on the 1st value. But when the 2nd value changes, you want the 1st value to be calculated based on the 2nd, ad infinitum. There are ways to short-circuit the loop, but it depends on whether you need to do the calculation only when there is manual entry, or whether you need it to work when either field value changes programmatically or by importing form data.

           

          Sometimes it's just easier to have the user press a button to calculate and set the other field value.