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

Javacript to enter check box value into text box.

Explorer ,
Nov 29, 2018 Nov 29, 2018

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
1.1K
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

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.

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

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

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

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?

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

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

AWESOME! It worked! Thanks for your help!

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