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

Is there a way to undo an action once a button has been clicked?

New Here ,
Jul 02, 2019 Jul 02, 2019

I am creating a form that has several signature fields for several different people to approve the document.  Not all signatures may be required, so I am creating buttons where the user clicks the button and the unneeded signature fields 'hide'. Is there a way to undo that action if the user decides the signature field they 'deleted' is now needed? The undo option under 'Edit' doesn't work. It seems that once the button has been clicked the action is performed and it's done and there is no undoing.  Does anyone know if an 'undo' option with buttons is available?

TOPICS
PDF forms
1.5K
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 ,
Jul 02, 2019 Jul 02, 2019

Here's a simple example of a script to toggle the visibility of a field:

var f = this.getField("Name of field goes here");

f.display = (f.display==display.visible) ? display.hidden : display.visible;

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
Community Expert ,
Jul 02, 2019 Jul 02, 2019

Add a button which performs the undo.

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 ,
Jul 02, 2019 Jul 02, 2019

You can use the same button to show/hide the fields, but that will require using a script.

The built-in Undo command will not work, I think.

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
New Here ,
Jul 02, 2019 Jul 02, 2019

try67 would you happen to know what the script is or where I can find it? Thanks!

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 ,
Jul 02, 2019 Jul 02, 2019

Here's a simple example of a script to toggle the visibility of a field:

var f = this.getField("Name of field goes here");

f.display = (f.display==display.visible) ? display.hidden : display.visible;

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
New Here ,
Jul 03, 2019 Jul 03, 2019

If I have more than field how do I do that as far as the script? Are the names separated by commas?

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 ,
Jul 03, 2019 Jul 03, 2019
LATEST

Not quite. You can use this code to do it:

var fields = ["Field1", "Field2", "Field3"];

for (var i in fields) {

    var f = this.getField(fields);

    f.display = (f.display==display.visible) ? display.hidden : display.visible;

}

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