0 Replies Latest reply on Mar 20, 2008 11:01 AM by (David_D._James)

    Override Field Calculation

      Can anyone please help me with this script problem? I am fairly new to Javascripting on Acrobat. I want the user to be able to override a field calculation. I was expecting to use one of the event handles like event.OnChange, but it doesn't see to work as expected.

      As a work around I put this code in the Custom Calculation Script. With this simple script the user can key in zero to envoke the calculation. In this example, the field we want to override is named f16. The field containing the calculation is f10. Any entry other than zero in f16 overrides the calculation. Enter zero f16 and the calculation appears.

      var f10val = this.getField("f10");
      var f16val = this.getField("f16");
      if (f16val.value==0) {event.value = f10val.value};

      It works but not as I would like. One problem is that zero is a valid override. I tried to test for null, but that did not appear to work. The other problem is that this calculating stops after the first calculation (once we arrive at an non-zero value).

      I have not been able to get the Javascript debugger in Acrobat to work so I can see what the problem is with the null test, and try some different things. I think another keystroke like pressing a function key to trigger the calculation would be a suitable fix. I imagined that I could tested for this condition with a commit event but I am unsure of the parameters.