Copy link to clipboard
Copied
I want to change the formatting of a value entered into a field based on that value. i.e. if value greater than 5, the value will appear bold and in red (6).
Thank you in advance for your help.
Enter this code as the field's custom validation script:
if (Number(event.value)>5) {
event.target.textFont = font.HelvB;
event.target.textColor = color.red;
} else {
event.target.textFont = font.Helv;
event.target.textColor = color.black;
}
I used Helvetica as the font. If you want to use another one you'll need to find out the name of the regular version and of the bold version of that font, as Acrobat doesn't have a "bold" setting, like Word does. I also assumed that you want the text
...Copy link to clipboard
Copied
Enter this code as the field's custom validation script:
if (Number(event.value)>5) {
event.target.textFont = font.HelvB;
event.target.textColor = color.red;
} else {
event.target.textFont = font.Helv;
event.target.textColor = color.black;
}
I used Helvetica as the font. If you want to use another one you'll need to find out the name of the regular version and of the bold version of that font, as Acrobat doesn't have a "bold" setting, like Word does. I also assumed that you want the text to be black if the value is less than (or equal to) 5, although you didn't specify that in your question.