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

Form Variable not working, Java, LiveCycle 8

rodbunn
Registered: Feb 3 2008
Posts: 81
Answered

I CAN get this to work;

Button1.border.fill.color.value = "255,0,0";

But if I define a "form variable" (call it redone) and make it 255, I CAN'T get this to work;

Button1.border.fill.color.value = "redone.value,0,0";

This is all in java script, LiveCycle 8

Anyone know what to do to get it to work?????

Thanks, Rod

My Product Information:
LiveCycle Designer, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
In LiveCycle JS the color values are in a string that looks like a list of values. So you have to build this string to set a color.

In JavaScript, anything in quotes is a string, so you can't place variables in quotes. Instead you have to concatonate the string variable with the static text. Rewrite your code like this.

Button1.border.fill.color.value = redone.value + ",0,0";

or, use the border color shortcut property


Button1.borderColor = redone.value + ",0,0";

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

rodbunn
Registered: Feb 3 2008
Posts: 81
Thanks, that worked. Here is the final java with three variables (one for red, one for green, one for blue).

redone, redtwo, and redthree are "form variables" and can be anyhing you want to call them. Their values (to creat red) are redone=255, redtwo=0, redthree=0

Button1.border.fill.color.value = redone.value + ","+redtwo.value+","+redthree.value;


Thanks again for the help. Wish someone would have put that little info in the HELP FILE ;-)

Rod
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Rod,
It's important to note that the problem was unrelated to Acrobat in any way. String handling and the language syntax are features of Core JavaScript, and this information is part of any Reference that deals with Core JavaScript. So you wouldn't expect string handling to be explicitly explained in the Acrobat References.

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script