Skip to main content
Markarius
Inspiring
January 30, 2020
Answered

box checked = Reset text box

  • January 30, 2020
  • 1 reply
  • 868 views

Hello,

 

I have a check box named "Box_APSOnlineReport" which when checked will display or hide a textbox called "TotalPages_APSOnlineReport".  I'm using the following code:

var nHide = event.target.isBoxChecked(0)?display.visible:display.hidden; this.getField("TotalPages_APSOnlineReport").display = nHide; this.getField("TotalPages_APSOnlineReport").display = nHide; this.getField("TotalPages_APSOnlineReport").display = nHide;

^ thank you try67!!! 🙂

 

I need additional code that when the box checked, (text field now visible), it will reset the text field.  I have put a default text value of "?" for the text field, so once it's reset it should just display the default value... so the idea is that every time the box is checked and text field is visible, the user will see "?" and will enter the correct value.

 

 

 

This topic has been closed for replies.
Correct answer Thom Parker

Add this code to the script.

 

if(nHide == display.visible)

this.resetForm(["TotalPages_APSOnlineReport","TotalPages_APSOnlineReport","TotalPages_APSOnlineReport"]);

1 reply

Thom Parker
Community Expert
Thom ParkerCommunity ExpertCorrect answer
Community Expert
January 30, 2020

Add this code to the script.

 

if(nHide == display.visible)

this.resetForm(["TotalPages_APSOnlineReport","TotalPages_APSOnlineReport","TotalPages_APSOnlineReport"]);

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often