Highlighted

Change colour of Comb field cells?

Jono_Moore

24-03-2009

Can't seem to find anything on this.



I'd like to change the background colour of some comb fields. I've tried "this.fillColor" but it does the whole box.

Replies

Highlighted

Steve_L_Walker

24-03-2009

For a text field called TextField1, try these client-side JavaScripts....



TextField1.resolveNode("ui.#textEdit").border.edge.color.value = "120,150,200";



TextField1.fillColor = "240,240,240";
Highlighted

Jono_Moore

25-03-2009

I tried that on the comb field and on a text field to test it and it doesn't seem to do anything? (The resolveNode script.)



I put it in the Initialize event for the field. I tried it with the field name and with "this". Fill.Color works but does the whole box including caption.
Highlighted

Niall_O_Donovan

30-03-2009

Jono,



I have had a look, using LC Designer ES it is possible to set the colour of the value portion of the view to grey by accessing the Object / Field / Appearance / Custom and setting the background fill to solid (and picking a colour).



If you are using an earlier version, then setting the background to white (which might set the whole field to white). Then in the initialise event:



var fld;

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

fld.value = "192,192,192";



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



Note that if the field does not have a background colour (i.e. at least white) then the script will not work.



Hope that helps,



Niall
Highlighted

Jono_Moore

30-03-2009

Thanks Niall!



I was trying to do it via the Border palette, forgot you could colour the fields from the Field palette!



Where did you find the info on the ui. elements?
Highlighted

Niall_O_Donovan

30-03-2009

Jono,



Can't remember exactly 😉 I know that the "fld" variable is not how I name variables, so I am guessing that I got the solution from this forum. Once I was put onto it, I got the other user interface definitions from the Abobe Calculations and Scripts file.



I also use JP Terry's book and Adobe reference documents.



Also check out

http://groups.google.com/group/livecycle

http://forms.stefcameron.com/

http://blogs.adobe.com/pdfdevjunkie/



Good luck,



Niall