Expand my Community achievements bar.

Change colour of Comb field cells?

Avatar

Level 10
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.
6 Replies

Avatar

Former Community Member
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";

Avatar

Level 10
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.

Avatar

Level 10
I've fixed it for now by putting a grey box behind the fields.

Avatar

Level 10
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

Avatar

Level 10
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?

Avatar

Level 10
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