Skip to main content
Participant
Jan 17, 2024 11:28 PM UTC
Question

I am making a calculator form. I need to get a text box to show if one value is larger than another.

If the value from box 1 is greater than the sum that generates into box 2, I need a text box to become visable with a warning in it. 
Question 1: Do I put the code in box 2 to make the text box pop up or in the properties for the text box?
Question 2: Why isn't this working.?

 

var v1 = Number(this.getField(“Box1”).valueAsString);
var v2 = Number(this.getField(“Box2”).valueAsString);
if (v1 > v2)
{
event.target.display = display.visible;
}
else
{
event.target.display = display.hidden;

This topic is closed to new replies. Start a new post to keep the conversation going.

2 replies

Thom Parker
Community Expert
Community Expert
Jan 18, 2024 12:17 AM UTC

That code was written to be placed in the custom calculation script for the field you want to be hidden or shown.

Here's an article on the topic:

https://www.pdfscripting.com/public/Hiding-and-Showing-Form-Fields.cfm

 

 

Translate
Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Participant
Jan 17, 2024 11:36 PM UTC

 

Translate