Help with PDF JavaScript

New Here ,
Jul 09, 2020

Copy link to clipboard

Copied

Hi community, 

      I would like some help with some javascript ! The script I found helps me with marking circles over answers on a pdf that I have. However, I would like some help changing the code so that if I click on the button again, the circle disappears--to give people the option of selecting and deselecting. Any help much appreciated. 

The code is below. Credit Source: http://khkonsulting.com/2016/11/mark-selected-options-with-circles-in-pdf-forms/#:~:text=On%20the%20...

var baseName; var currentState;

 

// get our name

var theName = event.target.name;

 

var re = /(.*)\.(.*)/; var ar = re.exec(theName);

 

if (ar.length > 0) {

    baseName = ar[1];

    currentState = ar[2];

 

    // make this button visible

     event.target.buttonSetIcon(this.getField("icon").buttonGetIcon());

     event.target.buttonPosition = position.iconOnly;

 

     // hide the other button var f_parent = this.getField(baseName);

     var f = f_parent.getArray();

     for (var i in f) {

          if (f[i].name != theName) {

               f[i].buttonPosition = position.textOnly;

           }

         }

       }

       this.calculateNow();

TOPICS
Acrobat SDK and JavaScript, How to, PDF forms

Views

81

Likes

Translate

Translate

Report

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

Help with PDF JavaScript

New Here ,
Jul 09, 2020

Copy link to clipboard

Copied

Hi community, 

      I would like some help with some javascript ! The script I found helps me with marking circles over answers on a pdf that I have. However, I would like some help changing the code so that if I click on the button again, the circle disappears--to give people the option of selecting and deselecting. Any help much appreciated. 

The code is below. Credit Source: http://khkonsulting.com/2016/11/mark-selected-options-with-circles-in-pdf-forms/#:~:text=On%20the%20...

var baseName; var currentState;

 

// get our name

var theName = event.target.name;

 

var re = /(.*)\.(.*)/; var ar = re.exec(theName);

 

if (ar.length > 0) {

    baseName = ar[1];

    currentState = ar[2];

 

    // make this button visible

     event.target.buttonSetIcon(this.getField("icon").buttonGetIcon());

     event.target.buttonPosition = position.iconOnly;

 

     // hide the other button var f_parent = this.getField(baseName);

     var f = f_parent.getArray();

     for (var i in f) {

          if (f[i].name != theName) {

               f[i].buttonPosition = position.textOnly;

           }

         }

       }

       this.calculateNow();

TOPICS
Acrobat SDK and JavaScript, How to, PDF forms

Views

82

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Jul 09, 2020 0
ls_rbls LATEST
Adobe Community Professional ,
Jul 14, 2020

Copy link to clipboard

Copied

I would say that, in lieu of no one responding to your inquiry yet, that the adequate netiquette (or to show some respect to  to the original author of this script)  is to contact Karl Heinz Kremer  at  KHKonsulting LLC: khkonsulting@khk.net

 

 

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 14, 2020 0