Skip to main content
Participant
March 24, 2024
Answered

Making text appear when another (calculated) field is a negative value

  • March 24, 2024
  • 1 reply
  • 564 views

Hi there

I'm creating a form in Acrobat Pro and one of the fields is calculated (Income minus Expenses = Net profit or Net Loss). When there is a Net Loss (negative value), I would like text to appear to say something along the lines of: "You are spending more than you earn". The negative value is an acceptable outcome, I just want to alert the user to the Net Loss.

Is there any way to do this?

Thank you 🙂

This topic has been closed for replies.
Correct answer try67

Create a (read-only) text field with this text set as its default value, and use the following as its custom calculation script:

event.target.display = (Number(this.getField("Net Result").value)<0) ? display.visible : display.hidden;

1 reply

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
March 24, 2024

Create a (read-only) text field with this text set as its default value, and use the following as its custom calculation script:

event.target.display = (Number(this.getField("Net Result").value)<0) ? display.visible : display.hidden;

Participant
March 25, 2024

Thank you so much! This worked perfectly!