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

Multiply drop-down box to text box.

Community Beginner ,
Mar 07, 2023 Mar 07, 2023

This should be an easy one.

 

I have a drop box (0-5) integer.  

Once the user chooses their integer from the dropdown box, the code will use the integer and multiply it by 100 and enter it in another text box. 

 

Who would you suggest starting my programming training with? 

 

Thank you for all the assistance. 

TOPICS
JavaScript
1.2K
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 07, 2023 Mar 07, 2023

Read this, and the 2 articles that are linked.

https://www.pdfscripting.com/public/Calculating-field-values-and-more.cfm

 

But you don't actually need programming to perform this calculation. It can be done with Simplified Field Notation. Look at the calculate tab on the form field properties dialog.

 

 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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 07, 2023 Mar 07, 2023

Hi @robert_daughdril ,

 

The community forums is a great place to start learning Acrobat Javascript.

 

There plenty of great developers here that can lead the way and get you on track.

 

For example, you may run a custom calculation script from the dropdown menu like so:

 

 

var f = this.getField("nameOfTextField");

(event.value != 0) ? f.value = event.value/100 : f.value = "";

 

 

Or use built-in features as suggested by @Thom Parker 

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 08, 2023 Mar 08, 2023
var f = this.getField("nameOfTextField"); (event.value != 0) ? f.value =
event.value/100 : f.value = "";

This worked great.

How do I get it to calculate as soon as I choose a number? It always waits
till I enter another choice.

Thank you so much for the help.
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 08, 2023 Mar 08, 2023
LATEST

Aahh! yes, I forgot to clarify:

 

  • go to the Dropdown Properties,
  • and in the Options tab tick the checkbox "Commit selected value immediately".
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