Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
2

Calculations with exponents in fillable form

New Here ,
Mar 17, 2024 Mar 17, 2024

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 🙂

TOPICS
How to
282
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 17, 2024 Mar 17, 2024
LATEST

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines