Expand my Community achievements bar.

on/off/neutral checkbox. Can I change the fontcolor of the checkbox with javascript

Avatar

Level 1

Hi,

I have a client who wants to use the on/off/neutral checkbox.

I am have written some javascript to change the style of the checkbox and what initally shows on first click. (se function)

var f = event.target.getField(sPath);
var txt7 = (xfa.resolveNode("Requests.UsersAndServices.userDetail.TextField7").rawValue == "one"?"true":"false");
if (txt7  == "true"){
  f.style = style.ch;
  xfa.resolveNode("Requests.UsersAndServices.userDetail.TextField7").rawValue = "zero";
 
}else if (val == 0){
  f.style = style.ch;
 
}
else if (val  == 1) {
 
  f.style = style.cr;
}
}

I have the cross in black font but the check (tick) is light grey. I want both the cross and check to be in black font.

Is there code like

this.fontColor = color.black ;

that will work for a checkbox.

Thanks

Geoff

7 Replies

Avatar

Former Community Member

Give this a go...

xfa.resolveNode("form1.page1.cb.font.fill.color").value = "192,192,192";

Steve

Avatar

Level 1

Thanks Steve,

It does change the fill color, but I think its the font weight that needs to be changed. I have tried this, but not working.

xfa.resolveNode(sPath + ".font.fill.color").value = "0,0,0";
xfa.resolveNode(sPath + ".font.weight").value = "bold";

Any ideas  ?

Thanks

Geoff

Avatar

Former Community Member

This will do it for check box 'cb'....

form1.page1.cb.caption.font.weight = "bold";

Steve

Avatar

Former Community Member

I am pretty sure that the user wants to change the weight of the tick in the checkbox (not the caption)

Using a tristate checkbox, the display defaults to a lighter shade, which is not always ideal.

Avatar

Level 10

The color of the checkmark in a check button cannot be changed.

It has always the same appearance, so everybody know what's the current status of the check button.

Transparent = off

Gray           = neutral

Black          = on

Avatar

Former Community Member

Hi there,

I'm fairly new to LiveCycle, and tring to understand if this code goes in the CheckBox "Initialize" function? Or somewhere else? I am also trying to create a tri-state checkbox which goes from blank (grey) to a check mark (green) to an "X" (red).

My current javascript is as follows:

form1.#subform[0].CheckBox1::click - (JavaScript, client)

var

f = event.target.getField(sPath);

var

txt7 = (xfa.resolveNode("form1.#subform[0].CheckBox1").rawValue == "one"?"true":"false");

if

(txt7 == "true"){

f.style

= style.ch;

xfa.resolveNode("form1.#subform[0].CheckBox1").rawValue

= "zero";

}

else if (val == 0){

f.style

= style.ch;

}

else

if (val == 1) {

f.style

= style.cr;

}

}

Any chance you can share with me what I need to do to make this happen?

Avatar

Level 10

Hi,

Here is an example, which includes script for changing the background colour, the mark colour and the mark type:

http://www.assuredynamics.com/index.php/category/portfolio/changing-the-visual-appearance-of-checkbo...

Hope that helps,

Niall