Highlight a field if a box is checked

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

Adobe Community Professional
Correct answer by Thom Parker | Adobe Community Professional

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

TOPICS
Acrobat SDK and JavaScript, Windows

Views

144

Likes

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

Highlight a field if a box is checked

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

Adobe Community Professional
Correct answer by Thom Parker | Adobe Community Professional

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

TOPICS
Acrobat SDK and JavaScript, Windows

Views

145

Likes

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
Mar 02, 2019 0
Adobe Community Professional ,
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

Likes

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
Reply
Loading...
Mar 02, 2019 1
joyk LATEST
Community Beginner ,
Mar 02, 2019

Copy link to clipboard

Copied

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

Likes

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
Reply
Loading...
Mar 02, 2019 0
Adobe Community Professional ,
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

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 02, 2019 1