Change the color of a connected line comment with a checkbox

Community Beginner ,
Apr 07, 2022 Apr 07, 2022

Copy link to clipboard

Copied

Hello everyone,

 

Im currently discovering adobe acrobate and i encounter some difficulties. I'm working on a railroad map with stations(represented as checkboxes) and segments between the stations. I used the comment option to draw segments of my network on my map, with connected lines. The aim of my work is to show wich segment is in maintenance and wich are still available.I  put checkboxes between each segments. When a checkbox is checked i want the segment before the checked box to be colored as green and if the box is not checked or unchecked the segment color is set to red.i put an example of the map and what i need (i made it manually but i need it to be automatic).

 

The probleme, I dont know how can I change the color of the colored line by checking the box and I don't find so much stuff that suit well my problem.

 

Thank you in advance

Nelson

 

TOPICS
Create PDFs , General troubleshooting , How to , JavaScript , PDF forms , Standards and accessibility

Views

73

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
community guidelines

correct answers 2 Correct answers

Adobe Community Professional , Apr 07, 2022 Apr 07, 2022

At checkbox properties->Action->MouseUp->Run Javascript add this code:
this.getAnnot(0,"Your annot name goes here").strokeColor = event.target.value == "Off" ? color.red : color.green;


To find your annot(drawing) name, select your annot and press CTRL+J
now in console window that pop paste this code:
this.selectedAnnots[0].name;
and press Enter to get name, now copy that name and put it into code where says "Your annot name goes here".

Likes

Translate

Translate
Adobe Community Professional , Apr 08, 2022 Apr 08, 2022

In the console window select the whole script and press ctrl + enter.

Likes

Translate

Translate
Adobe Community Professional ,
Apr 07, 2022 Apr 07, 2022

Copy link to clipboard

Copied

At checkbox properties->Action->MouseUp->Run Javascript add this code:
this.getAnnot(0,"Your annot name goes here").strokeColor = event.target.value == "Off" ? color.red : color.green;


To find your annot(drawing) name, select your annot and press CTRL+J
now in console window that pop paste this code:
this.selectedAnnots[0].name;
and press Enter to get name, now copy that name and put it into code where says "Your annot name goes here".

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
community guidelines
Community Beginner ,
Apr 08, 2022 Apr 08, 2022

Copy link to clipboard

Copied

Thanks a lot i think this might work but i encountered a litle problem in the window wich pop when ctrl + j on my annot i can't paste the code or write anything in the javascript section is that normal ?When i put the code on the console window and press enter nothong happens 😕

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
community guidelines
Adobe Community Professional ,
Apr 08, 2022 Apr 08, 2022

Copy link to clipboard

Copied

In the console window select the whole script and press ctrl + enter.

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
community guidelines
Community Beginner ,
Apr 08, 2022 Apr 08, 2022

Copy link to clipboard

Copied

LATEST

Thanks it work !!!

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
community guidelines