Skip to main content
pritym42174092
Participant
July 21, 2016
Resuelto

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

  • July 21, 2016
  • 2 respuestas
  • 1218 visualizaciones

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;   

}

Este tema ha sido cerrado para respuestas.
Mejor respuesta de JR Boulay

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.

2 respuestas

JR Boulay
Community Expert
JR BoulayCommunity ExpertRespuesta
Community Expert
July 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
pritym42174092
Participant
July 22, 2016

Thank you

Bernd Alheit
Community Expert
Community Expert
July 21, 2016

Is this a form created with LiveCycle Designer?

pritym42174092
Participant
July 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.

Bernd Alheit
Community Expert
Community Expert
July 22, 2016

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