Skip to main content
Inspiring
August 14, 2017
Answered

How to turn the calculation scripting OFF in a text field with a button

  • August 14, 2017
  • 1 reply
  • 1833 views

I am using Adobe Acrobat 11 to create the Forms.

I will be opening them and filling them out with Adobe Reader 11.

I have a submit button on a pdf form.

It works great.  I have recently added a hidden text field using the calculate script below to hide the button until certain fields have been filled in by the user.

This works great too.

My problem is, I have javascript running at folder level that hides the Submit button right before the SaveAs function.

This worked great, but now my problem is the newly added hidden text field using the calculate script to validate the other fields is keeping my Submit button "shown", and over riding the the folder level hide code.

How do I turn off the text field calculate script right before I want to hide the button and saveAs the document?

Below is the hidden button calculate script:

var bReady = true;

if(this.getField("Name").value.length == 0)

  bReady = false;

else if(this.getField("Value").value.length == 0)

  bReady = false;

if(bReady)

  this.getField("Submit").display = display.visible;

else

  this.getField("Submit").display = display.hidden;

Can I add a

if(bReady) && "the Submit button has not been pressed"

then make the Submit button visible

else hide it

How would this script be written?  I do not know how to use the && operand properly.

Thank you very much...

This topic has been closed for replies.
Correct answer try67

Add a hidden check-box and set it to be ticked when the Submit button is clicked. Then add to your code a condition that checks if that box is ticked. If so, it doesn't continue. And yes, "&&" is the AND operator in JS.

1 reply

KortegaAuthor
Inspiring
August 14, 2017

Or maybe the better question is,

How do I turn off the text field's custom calculation javascript from running once I hit the Submit button?

This may be an order of operation thing that I cannot figure out, or it may be something I can add to the script to turn off the text field or disable it.

Basically once the user has entered all the fields and the submit button appears, I do not need the hidden text field's custom calculation script any longer.  So how do I turn this off once it has performed its job?  Because right now it is keeping the "Submit" button visible even during "saveAs", which I am trying to hide it in that code.

try67
try67Correct answer
Community Expert
August 14, 2017

Add a hidden check-box and set it to be ticked when the Submit button is clicked. Then add to your code a condition that checks if that box is ticked. If so, it doesn't continue. And yes, "&&" is the AND operator in JS.

KortegaAuthor
Inspiring
August 14, 2017

Thank you for the direction, that worked!