## Sum up values

New Here ,
Aug 05, 2019

Copied

Hi, how can I sum up the following values?

[A-H]&[J-U]&[W-Z]

[a-z]

[I,II, III, IV, V, VI, VII]

`if (event.value=="A") { event.target.textColor = color.red;        this.getField("Field1").textColor = color.red;        this.getField("Field2").textColor = color.red;        this.getField("Field3").textColor = color.red; }else if (event.value=="B") { event.target.textColor = color.red;         this.getField("Field1").textColor = color.red;        this.getField("Field2").textColor = color.red;        this.getField("Field3").textColor = color.red; }else if (event.value=="C") { event.target.textColor = color.red;         this.getField("Field1").textColor = color.red;        this.getField("Field2").textColor = color.red;        this.getField("Field3").textColor = color.red; }else if (event.value=="D") { event.target.textColor = color.red;         this.getField("Field1").textColor = color.red;        this.getField("Field2").textColor = color.red;        this.getField("Field3").textColor = color.red; }else if (event.value=="a") { event.target.textColor = color.red;         this.getField("Field1").textColor = color.red;        this.getField("Field2").textColor = color.red;        this.getField("Field3").textColor = color.red; }else if (event.value=="b") { event.target.textColor = color.red;         this.getField("Field1").textColor = color.red;        this.getField("Field2").textColor = color.red;        this.getField("Field3").textColor = color.red; }else if (event.value=="c") { event.target.textColor = color.red;         this.getField("Field1").textColor = color.red;        this.getField("Field2").textColor = color.red;        this.getField("Field3").textColor = color.red; }else if (event.value>=0) { event.target.textColor = color.black;           this.getField("Field1").textColor = color.black;          this.getField("Field2").textColor = color.black;        this.getField("Field3").textColor = color.black; }else if (event.value=="I") { event.target.textColor = color.green;     this.getField("Field1").textColor = color.green;    this.getField("Field2").textColor = color.green;    this.getField("Field3").textColor = color.green; }else if (event.value=="II") { event.target.textColor = color.green;     this.getField("Field1").textColor = color.green;    this.getField("Field2").textColor = color.green;    this.getField("Field3").textColor = color.green; }else if (event.value=="III") { event.target.textColor = color.green;     this.getField("Field1").textColor = color.green;    this.getField("Field2").textColor = color.green;    this.getField("Field3").textColor = color.green; }else if (event.value=="IV") { event.target.textColor = color.green;     this.getField("Field1").textColor = color.green;    this.getField("Field2").textColor = color.green;    this.getField("Field3").textColor = color.green; }else if (event.value=="V") { event.target.textColor = color.green;     this.getField("Field1").textColor = color.green;    this.getField("Field2").textColor = color.green;    this.getField("Field3").textColor = color.green; }else event.target.textColor = color.blue;`

as well I would like to sum up the "get.Field" method. I tried this:

`this.getField(["Field1","Field2","Field2"]).textColor = color.red;`

but it didn't work

Most Valuable Participant
| Most Valuable Participant

OK, then I would do it like this:

`var newTextColor = color.black;var romanNumerals = ["I", "II", "III", "IV", "V", "VI", "VII"];if (romanNumerals.indexOf(event.value)!=-1) {    newTextColor = color.green;} else if (/^\d+\$/.test(event.value)) {    newTextColor = color.blue;} else if (/^[a-z]+\$/i.test(event.value)) {    newTextColor = color.red;}var fields = ["Field1", "Field2", "Field3"];for (var i in fields) this.getField(fields).textColor = newTextColor;`
TOPICS
Acrobat SDK and JavaScript

Views

118

Likes

Report

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

## Sum up values

New Here ,
Aug 05, 2019

Copied

Hi, how can I sum up the following values?

[A-H]&[J-U]&[W-Z]

[a-z]

[I,II, III, IV, V, VI, VII]

`if (event.value=="A") { event.target.textColor = color.red;        this.getField("Field1").textColor = color.red;        this.getField("Field2").textColor = color.red;        this.getField("Field3").textColor = color.red; }else if (event.value=="B") { event.target.textColor = color.red;         this.getField("Field1").textColor = color.red;        this.getField("Field2").textColor = color.red;        this.getField("Field3").textColor = color.red; }else if (event.value=="C") { event.target.textColor = color.red;         this.getField("Field1").textColor = color.red;        this.getField("Field2").textColor = color.red;        this.getField("Field3").textColor = color.red; }else if (event.value=="D") { event.target.textColor = color.red;         this.getField("Field1").textColor = color.red;        this.getField("Field2").textColor = color.red;        this.getField("Field3").textColor = color.red; }else if (event.value=="a") { event.target.textColor = color.red;         this.getField("Field1").textColor = color.red;        this.getField("Field2").textColor = color.red;        this.getField("Field3").textColor = color.red; }else if (event.value=="b") { event.target.textColor = color.red;         this.getField("Field1").textColor = color.red;        this.getField("Field2").textColor = color.red;        this.getField("Field3").textColor = color.red; }else if (event.value=="c") { event.target.textColor = color.red;         this.getField("Field1").textColor = color.red;        this.getField("Field2").textColor = color.red;        this.getField("Field3").textColor = color.red; }else if (event.value>=0) { event.target.textColor = color.black;           this.getField("Field1").textColor = color.black;          this.getField("Field2").textColor = color.black;        this.getField("Field3").textColor = color.black; }else if (event.value=="I") { event.target.textColor = color.green;     this.getField("Field1").textColor = color.green;    this.getField("Field2").textColor = color.green;    this.getField("Field3").textColor = color.green; }else if (event.value=="II") { event.target.textColor = color.green;     this.getField("Field1").textColor = color.green;    this.getField("Field2").textColor = color.green;    this.getField("Field3").textColor = color.green; }else if (event.value=="III") { event.target.textColor = color.green;     this.getField("Field1").textColor = color.green;    this.getField("Field2").textColor = color.green;    this.getField("Field3").textColor = color.green; }else if (event.value=="IV") { event.target.textColor = color.green;     this.getField("Field1").textColor = color.green;    this.getField("Field2").textColor = color.green;    this.getField("Field3").textColor = color.green; }else if (event.value=="V") { event.target.textColor = color.green;     this.getField("Field1").textColor = color.green;    this.getField("Field2").textColor = color.green;    this.getField("Field3").textColor = color.green; }else event.target.textColor = color.blue;`

as well I would like to sum up the "get.Field" method. I tried this:

`this.getField(["Field1","Field2","Field2"]).textColor = color.red;`

but it didn't work

Most Valuable Participant
| Most Valuable Participant

OK, then I would do it like this:

`var newTextColor = color.black;var romanNumerals = ["I", "II", "III", "IV", "V", "VI", "VII"];if (romanNumerals.indexOf(event.value)!=-1) {    newTextColor = color.green;} else if (/^\d+\$/.test(event.value)) {    newTextColor = color.blue;} else if (/^[a-z]+\$/i.test(event.value)) {    newTextColor = color.red;}var fields = ["Field1", "Field2", "Field3"];for (var i in fields) this.getField(fields).textColor = newTextColor;`
TOPICS
Acrobat SDK and JavaScript

Views

119

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Aug 05, 2019 0
8 Replies 8
Most Valuable Participant ,
Aug 05, 2019

Copied

Are these the only options?

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Aug 05, 2019 0
New Here ,
Aug 05, 2019

Copied

what do you mean with the only options?

edit:

there's a table with 30 rows and 3 columns. actually there are more options. field 1-3 only represents one row in this table

the color of one row should depend on the value that ist entered in the target field

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Aug 05, 2019 0
Most Valuable Participant ,
Aug 05, 2019

Copied

I mean if the only options are the lower and upper case letters and I-VI in Roman numerals.

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Aug 05, 2019 0
New Here ,
Aug 06, 2019

Copied

the options are lower and upper case letters, roman numerals I-VII and numbers

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Aug 06, 2019 0
Most Valuable Participant ,
Aug 06, 2019

Copied

OK, then I would do it like this:

`var newTextColor = color.black;var romanNumerals = ["I", "II", "III", "IV", "V", "VI", "VII"];if (romanNumerals.indexOf(event.value)!=-1) {    newTextColor = color.green;} else if (/^\d+\$/.test(event.value)) {    newTextColor = color.blue;} else if (/^[a-z]+\$/i.test(event.value)) {    newTextColor = color.red;}var fields = ["Field1", "Field2", "Field3"];for (var i in fields) this.getField(fields).textColor = newTextColor;`

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Aug 06, 2019 0
Aug 06, 2019

Copied

 trompete111  schriebwhat do you mean with the only options?edit:there's a table with 30 rows and 3 columns. actually there are more options. field 1-3 only represents one row in this tablethe color of one row should depend on the value that ist entered in the target field

What are the field names in the other rows?

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Aug 06, 2019 0
New Here ,
Aug 06, 2019

Copied

well I think I'll just number them eg Field11, Field 12, Field 13, Field 21, Field22, Field23,.. are there any other options?

thank you try67​ this is exactly what I was searching for. but i don't really understand wherefore you define

1. var newTextColor = color.black;

is this because of the presetting of the color? so that every field with the preset textcolor black is affected on the entered value or is it just random?

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Aug 06, 2019 0
LATEST
Most Valuable Participant ,
Aug 06, 2019