Highlighted

drop down list, check boxes and colours

SnookerDJ

10-03-2009

Hi there



Does anyone know the Javascript code that will enable me to change the actual background colours of just the fillable area of drop down lists and check boxes. I can get it to change color for the whole object but not the bits contained within it.



Many thanks

Replies

Highlighted

pguerett

10-03-2009

Acrobat does not support that. I suggest that you break the it into two separate objects, The caption and the checkbox. Then you can do it the way you did it before.
Highlighted

Niall_O_Donovan

10-03-2009

Hi Darren,



To achieve this in a checkbox (hazard1), I set up an invisible textfield with the following javascript in the calculate event:



var fld1 = xfa.resolveNode("form1.p4c.hazard1.ui.#checkButton.border.fill.color");



if (hazard1.rawValue == 1) {

fld1.value = "225,255,225";

}

else {

fld1.value = "255,225,225";

}



The reasons we had an invisible textfield is that we wanted to assess a group of checkboxes and if any of them were checked then they all turned green.



For the dropdown list (scaff_inspected) with specified values we used the following javascript in the validate event:



var fld;



fld = xfa.resolveNode("form1.p1.scaff_inspected.ui.#choiceList.border.fill.color");



if (this.rawValue >= 1 ) {

fld.value = "225,255,225";

}

else {

fld.value = "255,225,225";

}



It appears that you can access the fill colour using the .ui appraoch, note that you need to correct notation for the field you are using, for example:



Date field = .ui.#dateTimeEdit

Dropdown = .ui.#choiceList

Checkbox = .ui#checkButton

Text field = .ui#textEdit

Numeric field = .ui.#numericEdit



Hope that works for you,



Niall
Highlighted

SnookerDJ

10-03-2009

Hi Paul / Niall



The last bit of Niall's post was what I was looking for. Sorry if my original post was a little confusing.



Many thanks



Darren