Highlight a field if a box is checked

Community Beginner ,
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

157

Likes

translate

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

Adobe Community Professional , Mar 02, 2019 Mar 02, 2019
This MouseUp code will work for a single check box highlighting a field named TextAif(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

Likes

translate

Translate

Translate
Adobe Community Professional ,
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

Likes

translate

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

Copy link to clipboard

Copied

You're the best. Thank you for all your help!

Likes

translate

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?

Likes

translate

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