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

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

New Here ,
Mar 18, 2019 Mar 18, 2019

Copy link to clipboard

Copied

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

Views

212

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
Community Expert ,
Mar 18, 2019 Mar 18, 2019

Copy link to clipboard

Copied

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

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

Copy link to clipboard

Copied

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.]

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

Copy link to clipboard

Copied

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...)

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