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

Trying to check a Checkbox if the data in Form Field 1 equals a certain value

Guest
Mar 18, 2019 Mar 18, 2019

New to writing JavaScript.

ContractRateBook will have a 3-digit number coming form my database.

Read somewhere that I need to use event.value but not sure how.

Came up with this but not working.

Theft is the name of my Checkbox

var x = this.getfield("ContractRateBook").value;

if (x == 103)

{event.value = 0;

getField("Theft").checkThisBox(0,true);}

Thanks.

Pat

TOPICS
Acrobat SDK and JavaScript , Windows
404
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 18, 2019 Mar 18, 2019

When you say the value is coming from your database, do you mean you import it directly into the field? If so, how?

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
Guest
Mar 19, 2019 Mar 19, 2019

Yes.

Once I save the document with proper Form Field Names, I upload it to my Contract Tracking software where the Field Names automatically pull data from the software’s database.

I then run the document from within the software and it prints with the data in the fields.

Thanks.

var x = this.getfield("ContractRateBook").value;

if (x == 103)

{

event.value = 15;

getField("Theft").checkThisBox(0,true);

}

else

{

event.value = 0;

getField("Theft").checkThisBox(0,false);

}

[Private info removed. -Mod.]

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 19, 2019 Mar 19, 2019
LATEST

OK, then you can use this code as a doc-level script:

var x = Number(this.getField("ContractRateBook").value);

if (x == 103) this.getField("Theft").checkThisBox(0,true);

(Note that when you reply by email it includes your personal details in the signature. You might want to avoid that...)

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