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

Custom Calculation script not working in a fillable form - suggestions please

Community Beginner ,
Jul 18, 2023 Jul 18, 2023

Test Task javascript not working.png

I have entered the script to the right to the field highlighted in blue on the left...when I populate the unit size field, nothing shows up in the rate field.  I keep staring and do not understand my mistake.  Thank you - K

TOPICS
How to , JavaScript , PDF forms
930
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 ,
Jul 18, 2023 Jul 18, 2023

If this calculation script is entered into the "RateRow1" field then it cannot reference it self as is done in this code this.getField("RateRow1").  

You say you enter a value into the Unit size field, but this field is not being referenced in the script. I think you must mean to use this code in the script. 

this.getField("Unit Size")

 

 

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 Beginner ,
Jul 18, 2023 Jul 18, 2023

That is wonderful!  I modified my code to reflect and it worked!  So, if I may, I would also like the duplicate field "unit size on the second row to only populate if there is something in the field "extra row 1" is that possible too?  I am new to all of this and appreciate the assistance.

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 ,
Jul 18, 2023 Jul 18, 2023

ok - i jumped the gun...this did not resolve my issue.  It populated once.  when I went to change the unit size it did not update the amount and when i deleted the value it did not clear the calculated field...

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 ,
Jul 18, 2023 Jul 18, 2023
LATEST

That is because of the next error in the code. 

See this article:

https://www.pdfscripting.com/public/How-to-write-an-If-statement.cfm

The answer is in the 2nd code example.

 

 

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