Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Setting font size for multiple text fields with button

Lorezt
Level 1
Level 1

Hi. I have been on Adobe LiveCycle for awhile but I still have problems in optimizing scripts as I do not have any programming background.

I have multiple textfields and I would like to decrease its font size all together with a click of a button.

I went through the Adobe Community and found a helpful post and I took the script from it. However, as per the script below, I believe it can be optimized maybe using arrays. However, I have no idea how to go about it.

Can anyone help? Your suggestions / advice will be highly appreciated.


var currentSize = Signature.RepName.font.size;


var currentSize = Signature.RepPosition.font.size;


var currentSize = Signature.RepCompany.font.size;



var ptPlace = currentSize.indexOf ( "pt");


var currentSizeInt = currentSize.substr ( 0, ptPlace);


var newSizeInt = parseInt (currentSizeInt, 10) - 1;



// set that as the new font size ( adding the "pt" back on)



Signature.RepName.font.size = newSizeInt + "pt";


Signature.RepPosition.font.size = newSizeInt + "pt";


Signature.RepCompany.font.size = newSizeInt + "pt";





1 Reply
Lorezt
Level 1
Level 1

Oh wow! Okay! I did a little reading and I think I figured it out!

Working the way I want it, and it definitely looks less messier.


var signaturelines = new Array("RepName", "RepPosition", "RepCompany");




for (i = 0; i < signaturelines.length; i++){



var currentSize = Signature.resolveNode(signaturelines[i]).font.size;



var ptPlace = currentSize.indexOf ( "pt");


var currentSizeInt = currentSize.substr ( 0, ptPlace);


var newSizeInt = parseInt (currentSizeInt, 10) - 1;



// set that as the new font size ( adding the "pt" back on)



Signature.resolveNode(signaturelines[i]).font.size = newSizeInt + "pt";


}