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

Help with Java

New Here ,
Jul 15, 2020 Jul 15, 2020

Copy link to clipboard

Copied

Hello - I am very new to Java coding, and need some assistance with this task. 

I am not getting any errors with this code, BUT at the same time, nothing is happening with the form.

 

What i am trying to do

I have a checkbox.  I need to assign a  $ amt to the box

If check box is checked   - I need $ amt to appear in separate text box "ColAMT"

If check box is NOT checked -  i need 0 to appear in separate text box "ColAMT"

 

What I think should happen in the form, is the unchecked box should appear as "0" in the "ColAMT" box until it is checked.  Once it is checked an assigned number should appear

 

This is the code i am trying

var value = 5365; if (this.getField("COLBox").value!="On") Value += Number(this.getField("ColAMT").value);

var newValue = 0; if (this.getField("COLBox").value!="Off") newValue += Number(this.getField("ColAMT").value);

event.value = newValue;

 

Thank you, Courtney

TOPICS
Acrobat SDK and JavaScript

Views

252

Translate

Translate

Report

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

correct answers 1 Correct answer

Community Expert , Aug 07, 2020 Aug 07, 2020

Hey courtney, I think that you're complicating the script too much.  Also your code is not JAVA; you're using Acrobat JavaScript.

 

For the checkbox "COLbox",  all you have to is set the export value to "5635" (without the quotes, of course). See slide:

 

Cexport.png

 

And then go to filed   properties of  "colAMT"; set  the  custom format  for Number and "$" using the Acrobat custom built-in formats:

 

See next slide:

 

Cexport3.png

 

Next,  add the following custom calculation script to colAMT field:

 

 

if(this.getField("COLbox")
...

Votes

Translate

Translate
Community Expert ,
Aug 07, 2020 Aug 07, 2020

Copy link to clipboard

Copied

LATEST

Hey courtney, I think that you're complicating the script too much.  Also your code is not JAVA; you're using Acrobat JavaScript.

 

For the checkbox "COLbox",  all you have to is set the export value to "5635" (without the quotes, of course). See slide:

 

Cexport.png

 

And then go to filed   properties of  "colAMT"; set  the  custom format  for Number and "$" using the Acrobat custom built-in formats:

 

See next slide:

 

Cexport3.png

 

Next,  add the following custom calculation script to colAMT field:

 

 

if(this.getField("COLbox").value != "Off")

    event.value = (this.getField("COLbox").value);

 

 

See last slide:

 

Cexpoer2.png

Votes

Translate

Translate

Report

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