Copy link to clipboard
Copied
Hello,
I'm encountering a problem when I'm updating the PRICE1 value, it also updates PRICE2 (divides PRICE2 by 1.2 too) and vice-versa. There is no other javascript code.
My calculation order is : PRICE1 > TOTAL1 > PRICE2 > TOTAL2
Anyone can tell me where is the problem please ? Thank you
Copy link to clipboard
Copied
This is normal, as the calculation event is triggered when you change the value of any field in the file.
If set up correctly, this should not matter and should produce the right results. If it doesn't it means you have an error in your code or set-up, typically an incorrect calculation order, or a self-referencing calculation.
Copy link to clipboard
Copied
Thank you for responding.
If I understand correctly, I cannot use "event.value" if I want PRICE1 and PRICE2 to be independent ?
I also tried to use "this.getField("PRICE1").value=this.getField("PRICE1").value/1.2" but it only divides by 1.2 once and stops doing it when I type another number in PRICE1 field (PRICE2 still gets divided by 1.2) and when I change PRICE2, PRICE1 divides by 1.2
below is my calculation order
and here is my JS script :
//<AcroForm>
//<ACRO_source>PRICE1:Calculate</ACRO_source>
//<ACRO_script>
/*********** appartient à : AcroForm:PRICE1:Calculate ***********/
this.getField("PRICE1").value=event.value/1.2
//</ACRO_script>
//</AcroForm>
//<AcroForm>
//<ACRO_source>PRICE2:Calculate</ACRO_source>
//<ACRO_script>
/*********** appartient à : AcroForm:PRICE2:Calculate ***********/
event.value=event.value/1.2
//</ACRO_script>
//</AcroForm>
Is there a solution so PRICE1 and PRICE2 stay independent ?
Thank you
Copy link to clipboard
Copied
This is what I mean by a "self-referencing calculation". You can't use a field's own value in its calculation.
The fields are independent of each other. The way you set it up makes them dependent on themselves, though.
[Edited: Can't... Not can]