These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Change colour of 1st letter in field

PetafromOz
Registered: Jun 8 2009
Posts: 230

I'm trying to make the first letter in a field red - while the rest of the text remains black. The text in this field results from numbers entered in a previous field. So for example if 02 is entered in the Code field: A - AGRICULTURE, FORESTRY AND FISHING is displayed, or say 09 is entered in the code field, then B - MINING will be displayed in this field, 44 - H - ACCOMMODATION AND FOOD SERVICES, etc etc.

The first letter is a code division signifier, so I'd like that first letter A, B, C, etc. to stand out and be red.

This is what I've done:

form1.firstPage.ANZSICDiv::initialize - (JavaScript, client)

var FirstChar = (Rtrim(this), 1);
FirstChar.fontColor = "255,0,0";
this = FirstChar;

But, it doesn't work.
Any suggestions please?

from way... underground at Parkes - central West NSW - Australia

PetafromOz
Registered: Jun 8 2009
Posts: 230
I got around this by simply putting another field in front of it & hiding the borders - so that the first code letter goes into that field & is independent. Thus I can set it to be whatever colour I want. However, if anyone knows how to do the above, I'd still love to hear.

from way... underground at Parkes - central West NSW - Australia

radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
Ok, I have a fine solution for this.
In my example there is a text field (for input) and a text (for output) with two hidden floating text fields (one for the first character, one for the other characters).
In the first text field I put the calculation code:
Left(Textfeld1, 1)
And in the second one I used:
var MyLength = Len(Textfeld1)var MyNewLength = MyLength - 1 $.rawValue = Right(Textfeld1, MyNewLength)

For the first field I changed the text color to red.
So if I now type "Hello" into the text field, the text show also "Hello" with a red H.

https://share.acrobat.com/adc/document.do?docid=91cabf7c-83a3-46cd-b37b-1ffd45e0383e

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs