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

Javacript to enter check box value into text box.

Explorer ,
Nov 29, 2018 Nov 29, 2018

Copy link to clipboard

Copied

I have five checkmark boxes (1,2,3,4,5) and when any of the boxes are checked, I need that value of the checkbox to be added to a text box. Is there a script that can do this and separate the values with a comma?

TOPICS
Acrobat SDK and JavaScript

Views

699

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 , Nov 30, 2018 Nov 30, 2018

No, I missed one critical bit in that script. Add this to the end

event.value = cValue;

And you'll need to change the export value to the text you want added in the text box.

Votes

Translate

Translate
Community Expert ,
Nov 29, 2018 Nov 29, 2018

Copy link to clipboard

Copied

Yes, Use a calculation script on the text box.  Like this:

var cValue = "";

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

  cValue += this.getField("Check1").value + ",";

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

  cValue += this.getField("Check2").value + ",";

etc.

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

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
Explorer ,
Nov 30, 2018 Nov 30, 2018

Copy link to clipboard

Copied

I tried this in the 'custom calculation script' with the checkboxes named 'Check1', 'Check2', but it didn't enter the values into the text box.

The export value for the checkboxes is 'Yes'. Would this have anything to do with it not working?

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 ,
Nov 30, 2018 Nov 30, 2018

Copy link to clipboard

Copied

No, I missed one critical bit in that script. Add this to the end

event.value = cValue;

And you'll need to change the export value to the text you want added in the text box.

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

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
Explorer ,
Nov 30, 2018 Nov 30, 2018

Copy link to clipboard

Copied

LATEST

AWESOME! It worked! Thanks for your help!

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