Copy link to clipboard
Copied
In Excel I would do it like this:
= (total vacation - vacation already taken) - requested vacation
How can I write this into a text field in javascript?
If this is a calculation script replace this.getField("Ergebnisfeld").value = ... with event.value = ... .
Copy link to clipboard
Copied
Hi,
It is quite straight forward.
Copy link to clipboard
Copied
In SFN you need to escape space character with backslash.
Copy link to clipboard
Copied
As far as I've been able to try it, it doesn't work.
Is it possible for you to send me the exact code that I need to insert to accomplish a subtraction?
Copy link to clipboard
Copied
Thank you for this step-by-step description, very helpful.
But after several attempts I can say that it doesn't work.
It doesn't do subtraction.
Copy link to clipboard
Copied
I also tried it with GPT, here is the code. Thanks everyone for your help.
var fieldValue1 = parseFloat(this.getField("Textfeld1").value);
var fieldValue2 = parseFloat(this.getField("Textfeld2").value);
var fieldValue3 = parseFloat(this.getField("Textfeld3").value);
if (!isNaN(fieldValue1) && !isNaN(fieldValue2) && !isNaN(fieldValue3)) {
var result = fieldValue1 - fieldValue2 - fieldValue3;
this.getField("Ergebnisfeld").value = result;
} else {
this.getField("Ergebnisfeld").value = "";
}
Copy link to clipboard
Copied
If this is a calculation script replace this.getField("Ergebnisfeld").value = ... with event.value = ... .
Copy link to clipboard
Copied
I am very surprised. As you can see from the screenshots, the calculation works. Can you explain (with screenshots) what does not work for you?
Copy link to clipboard
Copied
I'm having the same issue. My fields are SUBTOTALA and SUBTOTALB
In the Simplified Field Notation box, I type:
SUBTOTALA-SUBTOTALB
Acrobat acts like it's going to calculate, the formula "blips" in the box, then the radio box goes back to no calculation. The same thing happens when I type
SUBTOTALA - SUBTOTALB
Copy link to clipboard
Copied
Radio-button fields do not have a Calculate tab... Where exactly are you applying this code?
Copy link to clipboard
Copied
Well, I did the EXACT SAME CODE in the EXACT SAME PLACE today and it worked perfectly. I saved quickly, thanked my lucky stars and went on my merry way!
Copy link to clipboard
Copied
What field names do you use?