Copy link to clipboard
Copied
I want to have a fillable form where you can write a number with an exponent, and use that number to calculate something else.
Like if I have a box, text1, where you can write "2^3"
And another that multiplies the value by 10, so it returns 80.
I tried with both *number*E*exponent*, and *number*^*exponent*, but nothing seems to work.
I'm very new to Acrobat, so I don't know if this is easy or not. Thanks in advance 🙂
Copy link to clipboard
Copied
You can use Math.pow() to calculate exponent.
If you enter a value like this: "2^3" you will have to split the string and then calculate.
Something like this, as custom calculation script of a field where you want to show result:
var f = this.getField("text1").valueAsString;
var str = f.split("^");
if(f !== "")
event.value = Math.pow(Number(str[0]), Number(str[1]))*10;
else
event.value = "";
Find more inspiration, events, and resources on the new Adobe Community
Explore Now