I would like to change the font color of textfieldB when the user exits textfieldA by means of JS
Right now, I am using textfieldB.fontColor = "0,0,0"; (the font color is originally (255,0,0)
When I preview the form, nothing happens. No error in the console, no changing colors.
What am I doing wrong?
Graham
Solved! Go to Solution.
Views
Replies
Total Likes
The issue is that the field you are trying to set is not a TextField but a regular Text object. The fontColor is not a valid property of that object. To get at the Text objects font color use this expression:
PlainText.font.fill.color.value
= "0,0,0";
Paul
Views
Replies
Total Likes
Hi Graham,
Seems to work for me, I've attached a sample, hope that helps.
Bruce
Views
Replies
Total Likes
Hmmm, curious....
Yes, BR, yours does work. So I altered your example to more closely fit my needs and it appears something I left out is causing the problem. See the attached example.
To explain more robustly, I am filling a text box with the contents of user input from a text field. As long as I keep the second text field, it works, but although I can copy the contents of the text field to a text box, the fontColor doesn't work.
Views
Replies
Total Likes
The issue is that the field you are trying to set is not a TextField but a regular Text object. The fontColor is not a valid property of that object. To get at the Text objects font color use this expression:
PlainText.font.fill.color.value
= "0,0,0";
Paul
Views
Replies
Total Likes
Thanks Paul, that did the trick.
I notice that there is no mention of this in the LiveCycle Designer ES Scripting Reference document. Is this because it's not a standard call, or is it because I should figure that fill.color.value can be applied to many things and not just the few mentioned in the reference?
Anyway, thanks!
Graham Calhoun
Views
Replies
Total Likes
Actually what I do is look at the XML source to see what path is being used to set the value ...then I merely duplicate it in the call. In the docs each property and method is defined ...you just need to know that color is a subset of fill etc.
The fillcolor is a shortcut that was added to a TextField to make it easier than having to go through the whole path.
Paul
Views
Replies
Total Likes
When you said: "Actually what I do is look at the XML source to see what path is being used to set the value..." I thought, Voila! That's how I can quickly get path information to add to scripts (I'm a REAL newbie).
Having not looked at the XML Source tab much before, I quickly went to check it out. Unfortunately, I see nothing related to hierarchy in the XML source. Are we looking at the same thing?
Graham
Views
Replies
Total Likes
Yes we are ....once in the XML source you can click on an object in the hierarchy and the cursor will move to that definition. In the case of your Text object here is the XML that defines it:
Note that the name attribute of the draw is "PlainText". Then below that we have a font definition ....so following the hierarchy of the XML we get:
PlainText.font.fill.color.value
In some case the value attribute is implied and in others it is stated in the structure. If I wanted to get at the text that is being displayed I would use:
PlainText.value.text.value
Make sense?
Paul
Ahhh, yes! I DO see! Thanks a bunch!
Graham
Views
Replies
Total Likes
Great tip - thanks Paul!
Makes understanding what's going on much easier.
Views
Replies
Total Likes
Views
Likes
Replies