Javascript for subtraction
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?
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?
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 = "";
}
If this is a calculation script replace this.getField("Ergebnisfeld").value = ... with event.value = ... .
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.