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

Javascript on an IF/ELSE Compound statement to either Bold or Highlight the result

AdminLinda
Registered: May 9 2011
Posts: 3
Answered

Hi I am new to the forum but I have been using Adobe Professional 6.0 for the last five years. I use javascript now to help me with calculations in forms so am very young at it.
 
I have a text field that will have any number between 1 to 100.
Anything less than ten will not be highlighted. If any number greater than or equal to 10, I would like the number either to be BOLD or fill the text box with a color.
Is this possible? I have been searching for weeks and trying different codes without any success. I think I am missing a link between the two calculations, as I did get the highlighting to work but on the text field below the one I wanted and when the number changed to below 10 the highlighting stayed. Do I need an If / Else statement. Or do I need something completely different.
 
I have tried compound If (AND and Or) I have tried fill color.

AdminLinda

My Product Information:
Acrobat Pro 6.0, Windows
try67
Expert
Registered: Oct 30 2008
Posts: 2398
Accepted Answer
You can try this code as the custom validation script of your field:

if (Number(event.value)>=10) {event.target.fillColor = color.yellow;} else event.target.fillColor = color.white;

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

AdminLinda
Registered: May 9 2011
Posts: 3
try67 I cannot thank you enough, it worked a treat you have made my day.

AdminLinda