Skip to main content
Participant
January 17, 2024
質問

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

  • January 17, 2024
  • 返信数 2.
  • 251 ビュー

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;

このトピックへの返信は締め切られました。

返信数 2

Thom Parker
Community Expert
Community Expert
January 18, 2024

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

 

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Participant
January 17, 2024