Skip to main content
Participant
March 17, 2024
Question

Calculations with exponents in fillable form

  • March 17, 2024
  • 1 reply
  • 419 views

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 🙂

This topic has been closed for replies.

1 reply

Nesa Nurani
Community Expert
Community Expert
March 17, 2024

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 = "";