I have a few text fields that I want to set the background, or fill color to a different color when the form opens. I want these fields (not the captions) to stand out from the others, rather than making them required fields.
Subform_Employee_Info.Table1.Row1.Name.ui.oneOfChild.border.fill.color.value = "0,200,0"; // green
I want the new fill color to show when the form opens.
How would I go about accomplishing this, and at the same time, making sure that the field color does not print?
The problem with this solution is that it will turn off field highlighting for ALL fields. It may help with the fields I want to color, but all of the other fields will be white, confusing the user.
Also, turning off highlighting with my form will leave the user with this feature disabled. I wouldn't want to mess with someone's environment and risk ticking them off. I don't want to rely on them knowing how to re-enable highlighting.
Ahh never thought of the highlighting , nice thinking...
Now that the problem has been found you can use other methods to help you do exactly as you want
If you want to make sure the highlighting fields is off, you can just use this line of code
there's always a way -- i think i stumbled across a solution (a 'workaround' really) -- it's late here so i'll attempt the solution tomorrow..
Well....it does work...BUT, as you mentioned, there's no way to ensure that users will disable Highlight Fields.
Unfortunately, I can't use the solution. It has to work without requiring the users to modify any settings. They must be able to open the document and have it work without having to do anything else.
Oh well, I guess this one's going to have to go under the "Not Possible" column.
OK >> I solved it... SOLVED!!!!!
The video indicates that you have HIGHLIGHT Fields setting active in Adobe Acrobat Pro/Reader - if you switch this off you will get the behaviour you expect. I'm not sure you will be in love with this solution (as it is difficult to ensure other users will switch off this setting) but -- staying on topic -- if you test my form again after switching HIGHLIGHT Fields off in Adobe Acrobat Pro/Reader it should perform exactly as you intend (assuming I've finally interpreted your intentions correctly).
does it work now... YAYYYYY!
This does not work either. Field color only changes when clicking on field.
Very sorry for this tiny error, instead of inserting the fill node in the /ui/textEdit node,
it must be inserted in the /ui/textEdit/border node
So this is where you should add it
Afterwards LiveCycle change it, that's why I thought it had to be in the textEdit node
Hope it will work!
That's the code I mentioned in my original post. But, you're getting close....
I opened your modified form in Reader, and the field's value color changes now, but only after you click in the field. Once you leave the field, the value color reverts back to the default.
The goal is to have the value's color changed when the form opens, and have it stay that color. The user should not have to click in the field to get the color to change.
Here's a video of what is happening.
Using your form >> I've put the "correct" code in the field and it works fine for me. No need to mess with the XML source.
I'll post the form back here for you to use >> all the best..
BTW, I'm using LiveCycle Designer ES4. I made the change to the field's XML, then tried to preview, but no change in color.
Thanks for your input. Unfortunately, no luck with the suggestion.
I created a new form with just one text field and applied your suggested code to the XML for the field. No color change.
Here's the form that I created as a test: http://tinyurl.com/o32e76p
Here's the field's XML: (The addition is in bold)
<field name="TextField1" y="6.35mm" w="92.075mm" h="9.525mm">
<font typeface="Myriad Pro"/>
<margin topInset="1mm" bottomInset="1mm" leftInset="1mm" rightInset="1mm"/>
<para vAlign="middle" widows="2" orphans="2"/>
So seems like Reader doesn't want to make it work, whatever what options is done it wont make it work..
To do this, you must edit the XML source of the TextField.
So instead of using the LiveCycle UI to edit the color of your object, go in XML Source,
Look for the entire node of your field Name, then look for the "textEdit" node and insert these lines of code inside it
So it should look something like this...
This will premanently set the content's field to green in your form, but you can change it if whenever the field's value is changed or anything like this.
Hope this will help ya!
I had tried your suggestion before, but it colors the whole field green, instead of just the value (content) area. I don't want to change the color of the caption, just the value.
Here's the result of your suggestion:
my guess is that the error relates to incorrent SOM path referencing.
script to be placed in target field ('Name') on the [initilize] event
this.fillColor = "0,200,0"; // green
Sorry the link is not working
Well, it appears to be pretty straight forward. Yet...it doesn't work.
Here's a sample form I just made using the code from Cameron's article to change the color of the Content Extent fill. The code was placed in the Name field's initialize event. Also tried in the form's initialize and docReady events.
Give it a try for yourself to see what I am talking about. Do you have any suggestions??
Well you must be doing something wrong because it should be working just as you presented it on your first post
Tried that as well, in both the form1 docReady and Initialize, and no luck. There has so be a way to do this.
try the code in the form1: docReady or initialize instead of the field's event
Yes, I read the article first, which is where I got the syntax from in the original post.
I tried using the docReady event, but get the same results. The field color is light blue when the form opens, but only changes to green once you click on the field.
maybe you should try in the docReady event instead of initialize
hope this help!
OK, but how do I change the color of the field when the form opens. That's the part that is not working. Please see the original post.
You can again change the color of fields on PrePrint Event.