Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How do I change the background color of textField2 based on the value entered in textField1(Acrobat DC)?

New Here ,
Jul 21, 2016 Jul 21, 2016

Could you please help me solve this issue (I'm new to adobe acrobat dc):

Javascript written in textfield1(Color1) - Actions:

var C1 = this.getField("Color1");

var S1 = this.getField("Swatch1");

switch (C1.rawValue)

{

  case "PMS 100":

  S1.border.fill.color.value = "0,174,239";

     break;

  case "PMS 101":

  S1.border.fill.color.value = "236,0,140";

     break;   

}

TOPICS
Acrobat SDK and JavaScript , Windows
1.1K
Translate
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

Community Expert , Jul 22, 2016 Jul 22, 2016

Hi.

You can use this JavaScript (not tested) as a calculation script in the textfield2:

var myField = this.getField("textField1");

if (myField.valueAsString == "AAA") {event.target.fillColor = color.red;}

else if (myField.valueAsString == "BBB") {event.target.fillColor = color.blue;}

else if (myField.valueAsString == "CCC") {event.target.fillColor = color.black;}

// etc.

Translate
Community Expert ,
Jul 21, 2016 Jul 21, 2016

Is this a form created with LiveCycle Designer?

Translate
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
New Here ,
Jul 21, 2016 Jul 21, 2016

I'm trying to create form with acrobat dc not life cycle designer. I was able to create this in life cycle designer. But it doesn't work in acrobat dc.

Translate
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 Expert ,
Jul 21, 2016 Jul 21, 2016

Don't use JavaScript for Designer. Use JavaScript for Acrobat.

Translate
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
New Here ,
Jul 22, 2016 Jul 22, 2016

Javascript is being used for Acrobat DC and it's not working.

Translate
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 Expert ,
Jul 22, 2016 Jul 22, 2016

Did you read the Acrobat JavaScript Reference?

Translate
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 Expert ,
Jul 22, 2016 Jul 22, 2016

Hi.

You can use this JavaScript (not tested) as a calculation script in the textfield2:

var myField = this.getField("textField1");

if (myField.valueAsString == "AAA") {event.target.fillColor = color.red;}

else if (myField.valueAsString == "BBB") {event.target.fillColor = color.blue;}

else if (myField.valueAsString == "CCC") {event.target.fillColor = color.black;}

// etc.


Acrobate du PDF, InDesigner et Photoshopographe
Translate
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
New Here ,
Jul 22, 2016 Jul 22, 2016
LATEST

Thank you

Translate
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