Copy link to clipboard
Copied
Can someone pls help.
event.value = Number(this.getField("num1").valueAsString)*7 + "%";
event.value = Number(this.getField("num2").valueAsString)*7 + "%";
Only the second code is working but I need both of them to work,if value is changed in "num1" field I need first code to activate and if value is changed in "num2" field I need second code to activate.
Copy link to clipboard
Copied
You mean, you want a change in num1 to cause it to completely ignore num2, unless someone later changes num2, in which case it will ignore num1? That's very unusual and certainly can't be done from a calculation field. You'd need to trigger actions as num1 and num2 are changed.
Copy link to clipboard
Copied
num1 and num 2 is not important I just wanna know if it's possible for both codes to work their job at the same time and how to make it do that?
Copy link to clipboard
Copied
The second line will overwrite the result of the first one. In order to do what you describe you need to move your code to the validation scripts of the "num1" and "num2" fields.
Copy link to clipboard
Copied
That wouldn't work.I have 2 buttons,but1 activate num1 and but2 activate num 2 and result from num1 and num 2 is showed in textfield (t1) but they can't overwrite one another they need to add to same field,(example: but1 activate num1 which add 4 to t1 but2 activate num2 which also add 4 to t1 which now show 8.thats why I need both of the codes to work at same time cuz I use that code on t1 field as custom validation.
Copy link to clipboard
Copied
Thx guys for help I figure it out with this code that was lucky guess cuz I don't know anything about coding.
event.value = Number(this.getField("num1").valueAsString)*7 + Number(this.getField("num2").valueAsString)*11;