Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

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

Explorer ,
Aug 14, 2017 Aug 14, 2017

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...

TOPICS
PDF forms
1.9K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
1 ACCEPTED SOLUTION
Community Expert ,
Aug 14, 2017 Aug 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.

View solution in original post

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 14, 2017 Aug 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 14, 2017 Aug 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 14, 2017 Aug 14, 2017
LATEST

Thank you for the direction, that worked!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines