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

Multiplying a form field by a specific number.

New Here ,
Jan 08, 2019 Jan 08, 2019

How do I multiply a numerical form field by a specific number that is not in a form field?  I have absolutely no experience with Javascript.  Please HELP!

15.9K
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
2 ACCEPTED SOLUTIONS
Community Expert ,
Jan 08, 2019 Jan 08, 2019

Let's say the first field is called Text1 and you want to multiply its value by 8 and show the result in Text2.

You can do it using this code as the custom calculation script of Text2:

event.value = Number(this.getField("Text1").valueAsString) * 8;

Also, see this tutorial: https://acrobatusers.com/tutorials/how-to-do-not-so-simple-form-calculations

View solution in original post

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 ,
Feb 05, 2025 Feb 05, 2025

Under the Simple Field Notation option in the Calculate tab of Fees enter this:

Volume * 0.03

View solution in original post

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 ,
Jan 08, 2019 Jan 08, 2019

Let's say the first field is called Text1 and you want to multiply its value by 8 and show the result in Text2.

You can do it using this code as the custom calculation script of Text2:

event.value = Number(this.getField("Text1").valueAsString) * 8;

Also, see this tutorial: https://acrobatusers.com/tutorials/how-to-do-not-so-simple-form-calculations

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
New Here ,
Jan 08, 2019 Jan 08, 2019

THANK YOU THANK YOU THANK YOU!  I appreciate it so much.

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 Beginner ,
Mar 02, 2024 Mar 02, 2024

Great answer! Thanks. If you're willing to add more, I was needing to know:

What additional script would I need if I want Text2 to be left blank and ONLY want something to show in Text2 if Text1 has input?

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 02, 2024 Mar 02, 2024

Use this:

if(this.getField("Text1").valueAsString === "")
event.value = "";
else
event.value = Number(this.getField("Text1").valueAsString) * 8;
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 Beginner ,
Mar 03, 2024 Mar 03, 2024

Perfect! Thank you so much!!

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 Beginner ,
Feb 05, 2025 Feb 05, 2025

I was wondering if I could get a little help, cause I can't seem to figure this out.  I have a field where I will enter volume and need it to calculate the fee.  See attached screen shot.

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 ,
Feb 05, 2025 Feb 05, 2025

Under the Simple Field Notation option in the Calculate tab of Fees enter this:

Volume * 0.03

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 Beginner ,
Feb 05, 2025 Feb 05, 2025

Worked!! Thank you so much!  I didn't put any spaces between them and so it wasn't working, works like a charm now!  You rock!!

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 ,
Feb 12, 2025 Feb 12, 2025
LATEST

[MOVED TO THE ACROBAT DISCUSSIONS]


Acrobate du PDF, InDesigner et Photoshoptographe
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