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

Highlight a field if a box is checked

Explorer ,
Mar 02, 2019 Mar 02, 2019

Copy link to clipboard

Copied

I have a form that is displaying two options, and I need to make it more obvious which one they are selecting. So if they select option A (box) I need text field A to have a border color. If they select checkbox B, I need text field B to have the border color. I've tried running mouseup actions on the boxes but I must be doing something wrong. I am still learning JS..

Thanks!

TOPICS
Acrobat SDK and JavaScript , Windows

Views

684

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 , Mar 02, 2019 Mar 02, 2019

This MouseUp code will work for a single check box highlighting a field named TextA

if(event.target.value != "Off")

   this.getField("TextA").lineWidth = 1;

else

   this.getField("TextA").lineWidth = 0;

For this to work the border color must already be set.  Change the field name to use on another checkbox

Votes

Translate

Translate
Community Expert ,
Mar 02, 2019 Mar 02, 2019

Copy link to clipboard

Copied

This MouseUp code will work for a single check box highlighting a field named TextA

if(event.target.value != "Off")

   this.getField("TextA").lineWidth = 1;

else

   this.getField("TextA").lineWidth = 0;

For this to work the border color must already be set.  Change the field name to use on another checkbox

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 ,
Mar 02, 2019 Mar 02, 2019

Copy link to clipboard

Copied

LATEST

You're the best. Thank you for all 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
LEGEND ,
Mar 02, 2019 Mar 02, 2019

Copy link to clipboard

Copied

What code and where did you place the code in the box?

Are you using check boxes?

If so, then you need to code both check boxes.

Are you using a drop down or list box?

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