Expand my Community achievements bar.

SOLVED

calculate.override bugs; LC ES 2; Acrobat 9.4/Reader 9.4

Avatar

Level 2

Hi All

I have encountered possible bugs in calculate.override.

It seems that I cannot turn it off and allow the user to type freely, and then turn it on again.

The situation simplifed:

1) There are 3 text boxes, A, B and C.

2) A and B are normal text boxes, free to type.

3) C is set as 'Calculated - Read Only', the calculation is A.rawValue + B.rawValue

Now I want to allow the user to type anything they want into C (by pressing a button), so I have to disable the calculation (and the read only attribute, set this to open).

I also want to restore the calculation if I wish  (by pressing a button).

I discovered several issues here:

==========

Disable Calc

==========

1) C.calculate.override = "disabled"; // disable calc

    Having only this line does nothing, the calculation still occurs, nothing has changed.

    Note that C is still read only and the user cannot type into the box, but for now I am just pointing out that the calculation should have stopped.

2) C.calculate.override = "disabled"; // disable calc
  C.access = "open"; // allow user to type

    This seems to work somewhat, however the calculation is STILL performed UNTIL the user actually types something into C.

    So I tried adding this line to change the value of C, thereby preventing having the user to type into C:

    C.rawValue = 0;

    This doesn't work, the rawValue of C does not change, the calculation is STILL performed UNTIL the user actually types something into C.

3) Tried messing around with the code to no avail:

    C.access = "open"; // allow user to type
  C.rawValue = 0;
  C.calculate.override = "disabled"; // disable calc

* It seems that C.calculate.override only does something when  C.access is used. *

==========

Enable Calc

==========

4) C.calculate.override = "error"; // restore calc

     Does nothing.

5)  C.access = "readOnly"; // user cannot type
  C.calculate.override = "error"; // restore calc

     Again does nothing.

6) C.calculate.override = "error"; // restore calc
   C.access = "readOnly"; // user cannot type

     Nothing again.

I have tried just about everything, mixing up code, trying "warning" instead of error and so on.

* I can't seem to restore calculation after disabling it *

Am I missing something here?

I can't seem to attach files, I could mail the PDF so you guys can mess around with it.

LC ES 2; Acrobat 9.4/Reader 9.4

Many thanks

Regards

Shivan

1 Accepted Solution

Avatar

Correct answer by
Level 10

I got it

This will restore the original calculation in the numeric field.

NumericField1.access = "readOnly";

NumericField1.calculate.override = "error";

NumericField1.value.overide = "0";

NumericField1.execCalculate();

View solution in original post

3 Replies

Avatar

Level 10

I did the same as you.

// Open the field to allow user entries

NumericField1.access = "open";

// Allow override, means you will not get an error message when the calculated value is changed

NumericField1.calculate.override = "disabled";

NumericField1.value.float.value = "0";

Restore original state of the field.

NumericField1.access = "readOnly"

NumericField1.calculate.override = "error"

NumericField1.rawValue = null

NumericField1.execCalculate()

But you're right, the restore does not work.

I tested execEvent("calculate") and execCalculate() with no avail.

Very odd!

Avatar

Correct answer by
Level 10

I got it

This will restore the original calculation in the numeric field.

NumericField1.access = "readOnly";

NumericField1.calculate.override = "error";

NumericField1.value.overide = "0";

NumericField1.execCalculate();

Avatar

Level 2

Hi Radzmar

Thanks for your replies.

All working now

Thanks!!!!