Highlighted

Coloring textfield on certain exportvalue in choicemenu

Community Beginner ,
Jul 27, 2020

Copy link to clipboard

Copied

In a choicemenu I do have some choices which a special announcement. Next to the 'normal' output in a outputfield I created a  extra outputfield. If ppl choose a speciality I explain that in that extra outputfield.
I like to have that outputfield colored red if certain exportvalues have a hit. On no hit I like to have the exportfield transparent. I thought this code could do that for me, but it ain't working.
Can you please have a look and tell me what's wrong? Please in simpel English.
var f = this.getField("Output_05");
if (cChoice=="10:1 b");
else if (cChoice=="10:1 d") {
f.fillColor=color.red;
} else {
f.fillColor=color.transparent
}

 

These are just two hits. appr I like to have about 15

Topics

Create PDFs, Edit and convert PDFs, How to, PDF forms

Views

16

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

Coloring textfield on certain exportvalue in choicemenu

Community Beginner ,
Jul 27, 2020

Copy link to clipboard

Copied

In a choicemenu I do have some choices which a special announcement. Next to the 'normal' output in a outputfield I created a  extra outputfield. If ppl choose a speciality I explain that in that extra outputfield.
I like to have that outputfield colored red if certain exportvalues have a hit. On no hit I like to have the exportfield transparent. I thought this code could do that for me, but it ain't working.
Can you please have a look and tell me what's wrong? Please in simpel English.
var f = this.getField("Output_05");
if (cChoice=="10:1 b");
else if (cChoice=="10:1 d") {
f.fillColor=color.red;
} else {
f.fillColor=color.transparent
}

 

These are just two hits. appr I like to have about 15

Topics

Create PDFs, Edit and convert PDFs, How to, PDF forms

Views

17

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
Most Valuable Participant ,
Jul 27, 2020

Copy link to clipboard

Copied

You need to use the OR logical operator, like this:

 

var cChoice = event.value;
var f = this.getField("Output_05");
if (cChoice=="10:1 b" || cChoice=="10:1 d") {
	f.fillColor=color.red;
} else {
	f.fillColor=color.transparent;
}

 

You're also missing the declaration of the cChoice variable, so I added it.

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...
Community Beginner ,
Jul 28, 2020

Copy link to clipboard

Copied

Hi try 67,
Many thanks again. Your explanation incl. prognosed code is very valuable for me: Thanks.
Now I can multiple exportvalues with || to color "Output_05" red: Great.

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...
Resources
One Stop Solution for Acrobat
Edit a PDF