These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Textbox fill change on check

FredF
Registered: Aug 13 2008
Posts: 2

Hi,

I am trying to change the background fill color (in order to highlight it) in a TextBox when a corresponding CheckBox is "checked." It used to work in Acrobat... now using LiveCycle Designer and I am having a tough time converting...

--------------------------------------
OLD ACROBAT CODE

var x = this.getField("TextField1");
var y = this.getField("CheckBox1");
x.fillColor = color.white;

if(y.isBoxChecked(0))
x.fillColor = color.white;
else
x.fillColor = color.ltGray;

--------------------------------------

"NEW" LIVECYCLE CODE

var myDoc = event.target;
var x = myDoc.getField("topmostSubform[0].Page1[0].TextBox1[0]");
var y = myDoc.getField("topmostSubform[0].Page1[0].CheckBox1[0]");

x.fillColor = "255, 255, 255";

if(y.rawValue == 1)
x.fillColor = "255, 255, 255";
else
x.fillColor = "168, 168, 168";

--------------------------------------

Any help or direction would be appreciated...

Fred F.

My Product Information:
LiveCycle Designer, Windows
Helen_Dyksley
Registered: Jun 4 2007
Posts: 27
Hi Fred,

On a Click event, try this JavaScript on a Checkbox. If the value is 1, the fill is red. If the value is 0, the fill is white and I changed the borders' edge back to white. Note: this was created for Designer 7.2.1.


if (CheckBox1.rawValue == 1) {
TextField1.border.fill.color.value = "255,0,0";
}
else if (CheckBox1.rawValue == 0) {
TextField1.border.fill.color.value = "255,255,255";
TextField1.border.edge.color.value = "255,255,255";
}